|
You can start by adding a Setup project to your solution. Just right click your solution name (bold type) in the Solution Explorer and click "Add Project..."
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hi, Dave,
I have two project in my app now. one is for the database setup, it will be a small setup wizard, after the user setup the database, then I want to pass the three value to the other project. how can I do it?
thanks!
Lisa
|
|
|
|
|
You don't.
Run your application's setup first. It shouldn't need any external information to be provided in order to complete the install. Code your database setup to ask for the parameters, install the database, test those parameters, then just put the parameters where your application will expect them, whereever you chose.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
sorry..Dave,
I still confuse the process...
here is in my solution explorer:
3 projects:
SetupWizard - Window application (for the copying a empty database to the target server and user provides the parameters)
MainProject - Window application (this is the application will run in target machine, and need the parameters for the connection to sql from SetupWizard application)
Setup - Setup Project (install the SetupWizard first, then install the MainProject)
Is my project setup right? I still don't know how to pass the parameters from SetupWizard to MainProject..
Lisa
|
|
|
|
|
You don't pass the parameters between the any of these. The parameters get saved to the location where your MainProject application expects to find them so it knows how to get to the database your SetupWizard project created.
Where does your MainProject expect to find the database parameters it needs to get to and login to the database?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Here is all I did for the parameters.
In SetupWizard project, it has a module file called public.vb
<br />
Module _public<br />
Public server, user, password, database As String<br />
<br />
End Module<br />
In my MainProject, it has a module file called PublicModule.vb
<br />
Module PublicModule<br />
Public DataSource As String =database<br />
Public DataServer As String = server<br />
Public UserID As String = user<br />
Public UserPassword As String = password<br />
<br />
Public objConn As OleDbConnection = New _<br />
OleDbConnection("Provider=SQLOLEDB;" & _<br />
"Data Source=" & DataServer & ";Initial Catalog=" & DataSource & ";" & _<br />
"User ID=" & UserID & ";Password=" & password & _<br />
";Auto Translate=True;Persist Security Info=False;" & _<br />
"Workstation ID=" & DataServer & ";Use Encryption for Data=False;")<br />
end module<br />
in the PublicModule, I can't do this
Public DataSource As String =database
Public DataServer As String = server
Public UserID As String = user
Public UserPassword As String = password
it doesn't sign value to it. the name is not declared.
Logically, the way I'm doing should be wrong, it can't just pass the parameters in the publicModule, but I don't know any other ways to do it. do you have any idea for it? I know that would be so easy to you, but I'm very dumb of this, could you please help me out of this. I very appricate of it. Thank you very much.
Lisa
|
|
|
|
|
Hi, well Mr.Yulianto told me the solution to put my application in start up folder but i want to do this task programmatically.So Any one please tell me how to make the application a service in VB 6 so that it starts automatically when the windows starts.
|
|
|
|
|
A quick google brings up a load of information. This one is of particular interest.
http://vbwire.com/advanced/howto/service2.asp[^]
As far as i know this is acurate as VB6 cannot create a service like VB.Net can.
Really google should be your first search before posting to the forums. It took me 5 seconds to find this article and would only take a few mins more to get all the info i would need to do this. So far it has taken you 2 posts and probably a good few hours to get this far by posting straight to the forums.
Asking in the forums is no replacement for some honest legwork.
Jon
|
|
|
|
|
Hi,
It can be done through 'Windows Services' in .NET
With Regards,
Pandian S
|
|
|
|
|
I managed to write a Server/Client application using sockets in VB.Net.My only problem is, once a client makes a connection, how does the server program gets the IP address of the client. The following are parts of the code for Server listening to incomming connections and the code for Client making a connection. Would appreciate someone can advise on this issue.
Many thanks,
BGM2291
<<<<< Server VB.Net Codes >>>>>>>>>>>
Private Sub DoListen()
Dim objIPAddress As System.Net.IPAddress
Dim strAddress As String
Try
' Listen for new connections.
listener = New TcpListener(System.Net.IPAddress.Any, 2001)
listener.Start()
Do
' Create a new user connection using TcpClient returned by
' TcpListener.AcceptTcpClient()
Dim client As New UserConnection(listener.AcceptTcpClient)
' Create an event handler to allow the UserConnection to
' communicate with the window.
AddHandler client.LineReceived, AddressOf OnLineReceived
Loop Until False
Catch ex As Exception
End Try
End Sub
<<<<<<< Client VB.Net Codes >>>>>>>>>>>
Private Sub ConnectToServer()
Dim strMessage As String
gboolConnected = False
Try
tcpClient = New TcpClient("192.168.1.32", 2001)
tcpClient.GetStream.BeginRead(byteReadBuffer, 0, READ_BUFFER_SIZE, AddressOf DoRead, Nothing)
Catch Ex As Exception
End Try
End Sub
|
|
|
|
|
Your .AcceptTcpClient call will return a TcpClient object, which in your case, you're using as a parameter to create a UserConnection object. That TcpClient object exposes properties which you can use to get the client's IP address. Specifically, CType(TcpClient.Client.RemoteEndPoint, IPEndPoint).Address
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
The VB.Net statement CType(TcpClient.Client.RemoteEndPoint, IPEndPoint).Address is invalid, as the RemoteEndPoint is not exposed by the tcpclient but exposed by the socket object returned when using listener.AcceptSocket.
The existing VB codes I have uses the tcpclient for reading and sending and to change to using the socket object will mean a revamp of the coding.
I hope my investigation of this issue is correct and there are some other means to get the IP Address using the tcpclient object.
Many thanks,
BGM2291
|
|
|
|
|
Your code is calling AcceptTcpClient, which returns a TcpClient object, which exposes a protected property called Client, which returns the underlying socket connection that is automatically created and managed for you by the TcpClient object.
The code I posted wasn't meant to be copyed and pasted into your code. You have to follow the object chain, using your own object names, to figure out the exact syntax. There IS a socket underlying a TcpClient object. Just get your hands on it and use its RemoteEndPoint property to get at the Address
Client property docs[^]
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Dear Dave,
I understand what you mean and re-code the server programs as shown below. Line 12 will cause an error ('RemoteEndPoint' is not a member of 'System.Net.Sockets.TcpClient') when rebuilding the project, because of MyClient.RemoteEndPoint.
Is my coding incorrect?
Private Sub DoListen()
Dim objIPAddress As IPAddress
Dim strIPAddress As String
Dim MyClient As TcpClient
1 Try
2 ' Listen for new connections.
3 listener = New TcpListener(System.Net.IPAddress.Any, "2001")
4 listener.Start()
5 Do
6 ' Create a new user connection using TcpClient returned by
7 ' TcpListener.AcceptTcpClient()
8
9 MyClient = listener.AcceptTcpClient()
10
11 Dim client As New UserConnection(MyClient)
12 objIPAddress = System.Net.IPAddress.Parse(CType(MyClient.RemoteEndPoint, IPEndPoint).Address.ToString())
13 strIPAddress = objIPAddress.ToString
14
15 AddHandler client.LineReceived, AddressOf OnLineReceived
16 Loop Until False
17 Catch ex As Exception
18 End Try
19 End Sub
|
|
|
|
|
Sorry, I had my head where it should never be.
In order for you to get at the Client protected property, you'd have to derive your own class from the TcpClient class. (Which is what I've done before and where my information came from...sorry!).
If you don't have the need to derive your own class, then you'll have to switch your code to Sockets and use AcceptSocket instead of AcceptTcpClient.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I want to select and rename the column name to PROD_ID( to product) and QTY( to total) in vb form and show resulting table in vb form
SALE_ID PROD_ID QTY
1 Tomatoes 30
2 Pears 20
3 Apples 10
4 Tomatoes 40
5 Oranges 15
6 Tomatoes 5
7 Apples 9
8 Apples 7
9 Pears 19
|
|
|
|
|
Use DataGrid Control, OleDbConnection, OleDbCommand, DataAdapter and DataSet like this:
Dim connectionString As String = "..."
Dim dbConnection As New OleDbConnection(connectionString)
Dim queryString As String = "SELECT [ZAM].* FROM [ZAM]"
Dim dbCommand As New OleDbCommand
dbCommand.CommandText = queryString
dbCommand.Connection = dbConnection
Dim dataAdapter As New OleDbDataAdapter
dataAdapter.SelectCommand = dbCommand
Dim dataSet As System.Data.DataSet = New System.Data.DataSet
dataAdapter.Fill(dataSet)
dgZam.DataSource = dataset
'dgZam.DataBind() - if you use ASP.NET
David
|
|
|
|
|
I have deployed version 1.0 of a COM component that contains a CheckRequirements method in an interface called IData. The component is used by several VB client applications.I now discover that the data type of one of the arguments must be changed from Integer to Long.i have do to fix the component without breaking the existing clients?
|
|
|
|
|
If I remember correctly, you have to compile the new component with binary compatibility turned on. I think you can set this in the Project Properties dialog. You'll need to supply the path to the previous version of the component.
... I think ... It's been so long since I've been in VB6...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Normally what Dave said would be correct. As far as i know that works if you change the way a method works but i dont think it will work in this case as you are actually changing the method. even with binary compatability if you add/remove methods or properties or change arguments you will probably need to recompile the client application as well.
Sorry if forgot that even VB6 can support multiple interfaces. You could create a new interface that new clients can use and change the internals of the method to check the type and convert the int to long.
This way existing clients are handled although if the problem is the data type sooner or later the problem will need to be addressed in the client.
Jon
|
|
|
|
|
You know, you're right! It didn't even hit me that he was changing the signature of a method call.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
how can i get an mdi child form to display in the client area of the core programs form, the mdi child forms are contained within plugin modules that are detected and loaded at run time ?
|
|
|
|
|
Your host application would have to apss a reference to the MDIParent form to any code that's going to create a child form. This is so the child form can be assigned the correct parent form.
Also, any child forms MUST be created on the same thread that the parent form was created on, otherwise, you'll never see the form.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks. My plugins are running as separate threads.
so i would have to pass a reference to the mdiChild to the host and get the host to create the form.
|
|
|
|
|
You got that right...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|