|
What are you connecting to on the AS400? A database or a terminal server (like TELNET)?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
It is a database. Basically, it is get connected, populate some text fields in Vb and then pass back the values. I am new to VB.Net and keep thinking VB6 but there must be other ways.
|
|
|
|
|
Actually, the database code is going to look about the same. Build a connection object, build a command object, open the connection, execute the command, yada yada yada. You could probably even use the same connection string you used in the VB6 code.
There is no AS400 provider in the .NET FCL, so I'm guessing that you'll probably have to use the OleDb classes as a "generic" object library that connects to the database.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hey all,
Is there a way to catch file-system events (like file creation\deletion\etc) from my comupter?
I know the .NET object FileSystemWatcher but it can't help me cause it asks for directory & I want to get the event from any disc on my computer..
It doesn't have to be a .NET object. a way to implement this would be helpfull too..
Thanks.
RoyRose78
|
|
|
|
|
It can be done, but requires writing a seperate .DLL, preferably in C++, to expose an interface for your managed code to use. This .DLL is a file system extension, intercepting all FileI/O calls into NTFS... I don't know of any publicly available code that demonstrates the techniques involved.
Oh! I almost forgot, the techniques involved will also require Admin rights in order to work!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hey Dave,
Thanks for replying.
Do you know any site \ book that I can use to examine this field..
Thanks again.
RoyRose78
|
|
|
|
|
Information is extremely limited because of how specialized the topic is. There just isn't a huge call for it. You can start by Googling for "NTFS File System Extension".
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I'm going to build the setup project for my app. but I have 3 steps to check for the target machine or server before install the app.
1. check framework in the target machine (if not, install the dotnetfx.exe)
2. check SQL Server, can be in the target machine or server (if not, install the MSDE in the target machine)
3. Ask for the Server name, user id, password, then check the database name XXX if exist? (if no, copy a database to the target sql server, if yes, ask for if want to overwrite)
after these 3 steps are checked, then install my app. How can I do these in vb.net? any idea?
one more thing, when the user input the server name, user id and password, this three value will send to the app. and use them to connect to the server. How can I do that?
Thanks!
Lisa
|
|
|
|
|
Well, this one is easy, you can't create an installer application in VB.NET. If the .NET Framework isn't installed, you're VB.NET installer app won't even run in the first place. You'll have to use a non-managed language to do this, like Visual C++.
There are samples around the 'Net that either demonstrate how to do this or are already written to do this and you just modify it and supply your componets to it. You can find more information in this article[^] by Davide Icardi.
As for your server name, userID and password, you'll have to write a custom action for the .MSI installer (which can be done in VB.NET!) and put up a form asking for these things. Once you have them, you can use the came code you write into your application to check to see if the database exists and the credentials work, then store those values in the place where your application is going to look for them.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
How to write a .MSI installer?
Lisa
|
|
|
|
|
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
|
|
|
|
|