|
This 3 Functions Would Help ya To Do what ever you wnat.
please Pay attention To Remarks !
you know The Sign of The End of String (Data into Text File)
Must be "$" !
For Example :
Ram,10/12/72,M
Harish Chandra,19/06/77,M
Vanitha,20/01/73,F
$
OR
Ram,10/12/72,MHarish Chandra,19/06/77,MVanitha,20/01/73,F$
'********************************************************
If you Wana To See a Compiled Version of this Application
Check it Out :
http://www.honarejavan.com/upload/convertor.exe
'Read Data From TextFile
Dim total As String
Public Function WRD(mypath As String)
Dim MyLines As String
Open mypath For Input As #1
Do While Not EOF(1)
Line Input #1, MyLines$
WRD = WRD + MyLines
total = total + MyLines
Loop
Close #1
End Function
'Create a DB ConnectionString For Access DB
Function ACC(PTH As String)
ACC = "Provider=Microsoft.Jet.OLEDB.4.0.1;" & _
"Persist Security Info=False;" & _
"Data Source=" & PTH
End Function
'Create a DB ConnectionString For SQL DB
Function fSQL(DBname As String, DBADR As String, UID As String, PWD As String)
fSQL = "Provider=MSDASQL;Driver={SQL SERVER};Server=" & DBADR & ";UID=" & UID & ";PWD=" & PWD & ";Database=" & DBname
End Function
'processing and insertion
Function insert_2DB(STR As String, connstr As String)
Dim i, j As Integer 'Counter
'TWord Hold ALL characters
Dim TWord(10000), DB_name, DB_Date, DB_gender As String
'********************************
Dim Conn As New ADODB.Connection
Dim RS As New ADODB.Recordset
'SQL Query
Dim strSQL As String
strSQL = "SELECT * FROM test"
'Opening DataBase
Conn.Open (connstr)
With RS
.CursorType = 2
.LockType = 3
End With
RS.Open strSQL, Conn
'********************************
'Loop For insert characters into arrey
For i = 1 To Len(total)
TWord(i) = Mid(total, i, 1)
Next
j = 1 ' First Value of j must Be 1
Do Until (TWord(j) = "$" And Not STR = "")
'Catch The Name From Each Line
Do Until TWord(j) = ","
DB_name = DB_name + TWord(j)
j = j + 1
Loop
'Jump of ","
j = j + 1
'Catch The Date From Each Line
Do Until TWord(j) = ","
DB_Date = DB_Date + TWord(j)
j = j + 1
Loop
'Jump of ","
j = j + 1
DB_gender = TWord(j)
If DB_gender = "m" Or DB_gender = "M" Then
DB_gender = "Male"
Else
DB_gender = "Female"
End If
'Ready To Count New Line
j = j + 1
'Inserting Data into Database
RS.AddNew
RS("name").Value = DB_name
RS("DoB").Value = DB_Date
RS("Sex").Value = DB_gender
RS.Update
' Reset Values
DB_name = ""
DB_Date = ""
DB_gendewr = ""
total = ""
Loop
RS.Close
Conn.Close
End Function
Good Luck
S.A Mousavi From Iran.
|
|
|
|
|
|
VB doesn't use the same format for an array that C++ does. VB uses OLE SAFEARRAY s.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
The following comes from MSDN Q207931
HOWTO: Pass Arrays Between Visual Basic and C
It is common to call from Microsoft Visual Basic a function in a DLL not specifically intended for Visual Basic, such as Windows API functions. Since the C function expects the address of the first element of the array, you can accomplish this in Visual Basic by passing the first element of the array by reference.
For example, the following is the prototype of a C function that returns the sum of long integers in an array. The first parameter is a pointer to the array and the second provides the number of elements in the array.
long AddLongs_Pointer(long *plArrayOfLongs, long lElements);
The Visual Basic version of the function declaration looks like this:
Declare Function AddLongs_Pointer Lib "MyDll.dll" (FirstElement As Long,
ByVal lElements As Long) As Long
To call the function, use the following code:
Dim MyArrayOfLongs(0 to 10) as Long
Dim lTotal as Long
' Insert code here to initialize the elements of the array
' Calling the function
lTotal = AddLongs_Pointer (MyArrayOfLongs(0), UBound(MyArrayOfLongs) + 1)
|
|
|
|
|
Hi,
I need to grab the window title bar from open application windows (any form eg. IE or notepad or any application) and look for a specific word "error".
However, I cannot seem to find any VBscript commands to grab the window title. Can anyone help?
Functions like GetWindowText(), GetWindow(), etc could not be used in my VBscript executable.
babtbaby
|
|
|
|
|
In VBScript alone, it can't be done. You'll have to write an external COM component that VBScript can instantiate and use, using WScript.CreateObject, that will do this search for you.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
In that case, could you kindly enlighten me further on what is the object to call upon? What is the object which I am supposed to create in order to reference to the get the title bar of all the open windows?
Thank you!
babtbaby
|
|
|
|
|
What you call the object is up to you, because you must write the component that will do this search. There is no object that will do it for you.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hmm actually i mean wat is the component I need to declare like CreateObject("Shell.Application") is the component Shell or others? I had tried Shell but Shell only can get the title bar from IE or folders windows, else it does not read. However, I have to get the title bar from an open application window. Any idea what is the component to use?
Thanx a great deal.
babtbaby
|
|
|
|
|
One more time: You have to write the component! There is no component that will do this for you!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
How do i read from an already opened text file using vb6.0..
I tried to write code which is here...
<br />
<br />
Private Sub Form_Load()<br />
<br />
Dim TxtSheet As Object<br />
<br />
Set TxtSheet = GetObject("d:\amit\1.txt")<br />
' This is a NOTEPAD APPLICATION AND IS ALREADY OPENED by some other application in write|append mode<br />
<br />
<br />
Dim buffer As String<br />
buffer = TxtSheet.Application.Value<br />
Text1.Text = buffer<br />
<br />
Unload Me<br />
<br />
End Sub<br />
<br />
amit mishra
|
|
|
|
|
Notepad just edits text files. Are you talking about opening and reading the file, or are you trying to the the contents of the Notepad window?
Notepad doesn't put any locks on the files it opens, so use standard file methods to open and read it.
Reading the Notepad window will be much more difficult to do in VB because now your trying to read the memory of another process, something that is "mostly" forbidden in Windows.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hello !!
I'm very new to VB programming and I would like to call a function I've written inside a dll. The function must receive a pointer to a Byte Array. So I suppose I have to declare something like that in VB:
Public Declare Function MyFunc Lib "MyDll.dll" (ByRef Data As Byte)
Ok, that's work fine but later when I want to call the function and send parameter, this doesn't work:
Dim arrData(0 To 1) As Byte<br />
arrData(0) = SomeData<br />
MyFunc(arrData)<br />
But this doesn't work: comple error ByRef argument type mismatch.
And I tried other things but nothing works... Sometimes the program compile and call the function but if I debug my dll, I can see that the data that is sent is not correct....
Any idea of how I can do that ?
Thanks
|
|
|
|
|
hi all,
how to show color palette in vb.net not color dialogbox
Waiting for u r replies.
With Luv,
Ashok s p
|
|
|
|
|
If you don't want to use the Color Dialog or 3rd party controls, you're going to have to custom draw this, possibly using GDI+. How this is done will depend heavily on how you want it to look. I suggest doing to research on Code Project and/or other sites, searching for "Color Picker".
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hi,
in some C#-Project a some comments included to describe the code better
the commands are
<Summary>
<Param>
<Return>
and so on
my question, is it posible to use it in VB .NET too?
Copyrights © 2003 by Paebbels.net
|
|
|
|
|
|
will this feature be part of Visual Basic 8.0? i read of many new featuren but this was not on the list (it was shortened by the author)
i think it's a discrimination of VB programers against C# programers ^^
there are 2 ways for C# Code:
- in-code comments like this XML-tags
or
- a link in the project-file to an external xml-documentation-file
but both failed with the VB Compiler
- syntax error
- the xml-files was not included
Copyrights © 2003 by Paebbels.net
|
|
|
|
|
Paebbels wrote:
will this feature be part of Visual Basic 8.0?
Yes (see How to: Create XML Documentation for Visual Basic[^]).
i think it's a discrimination of VB programers against C# programers
No, it's not. They're simply two different products and the teams making them prioritize features differently.
Best regards
Dennis
|
|
|
|
|
oh thanks,
I read this way of documentation in a C# Project with that style:
///<Summary>
///the text
///</Summary>
and I tryed this also in VB .NET with ' but not '''
...my mistake ...
Copyrights © 2004 by Paebbels.net
|
|
|
|
|
hi,
i'm from germany and so i dont know the right translation für
"Verweise" into englich (Buttontext of the english Visual Studio version)
- link
- refernez
- imports
- ...
i hope you know what i mean...
why is it impossible to set an "link" to an windows application (i.e. .exe-Project) to use this namespace?
in COM it was possible to refer to an ActiveX-EXE-Server, an exe-Project which provides several classes ...
Copyrights © 2003 by Paebbels.net
|
|
|
|
|
Paebbels wrote:
i'm from germany and so i dont know the right translation für
"Verweise" into englich (Buttontext of the english Visual Studio version)
What you mean is "reference".
why is it impossible to set an "link" to an windows application (i.e. .exe-Project) to use this namespace? in COM it was possible to refer to an ActiveX-EXE-Server, an exe-Project which provides several classes ...
Well, I also read your question about remoting (I didn't answer because I don't have any experience with it yet) and after that question of yours I guess you're mixing up some concepts. More precisely I think you should make yourself clear what the differences between Win32, COM and .NET are and how interoperability between these three technologies is achieved. Just have a look at these links to get started:
Windows API Start Page[^]
The Component Object Model: A Technical Overview[^]
What Is .NET?[^]
Introduction to COM Interop[^]
Best regards
Dennis
P.S. I'm from Germany myself so feel free to contact me in German. However if you want to do so I suggest you write to me via e-mail because I think it's impolite to use a foreign language in an english speaking newsgroup.
|
|
|
|
|
Hi All,
I've created an aspx page with a few textboxes and a button to send. Behind this button is the code:
Dim mailt As New MailMessage()
mailt.To = "myemail@gmail.com"
mailt.From = "testemail@hotmail.com"
mailt.Subject = "Subject"
mailt.Body = "Testbody"
mailt.BodyFormat = MailFormat.Html
System.Web.Mail.SmtpMail.SmtpServer = "smtp.mydomain.be"
System.Web.Mail.SmtpMail.Send(mailt)
The problem is this works but takes very long and I must delete the <..... INHERITS="mydomain.testmail"%>
otherwise I got the message error 503 the mailserver needs authorization.
What can I do or do I wrong?
Thx!
Peter alias SPYATNOON
|
|
|
|
|
Is it possible to put text next to icon.
I know if i change style and specify icon I can put icon on the command button
but when specifying caption automatically it goes to next line.
Shin
|
|
|
|
|
here's te deal i have a form that has 2 buttons on it.
i need to call the buttons click event from a different form in order to run the event i would just put the code into the form_load event but the form has a duel purpose so i can't do this.
so in VB.NET, how do we call the click event form a different form
i have tried the performclick() and this doesn't seem to work .
here is a sample of code
<br />
Private Sub EnterBtn_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles EnterBtn.Click<br />
' these next 2 lines remove the unwanted characters from the<br />
' beginning and end of the card value in this case, the card <br />
' values are 4 numbers delimited with a ; at the beginning<br />
' and a ? at the end<br />
txtPassID.Text = txtPassID.Text.Remove(0, 1)<br />
txtPassID.Text = txtPassID.Text.Remove(4, 1)<br />
'**********************************************************************<br />
CIfrm.txtPassIdSearch.Text = txtPassID.Text<br />
CIfrm.SearchIDBtn.PerformClick()<-- not performing as it should <br />
CIfrm.ShowDialog(Me)<br />
Me.Close()<br />
End Sub<br />
i have to different searches being performed depending on what form the user uses.
any help would be great
Help is great only if you ask correctly
|
|
|
|