Adding Nickname to Listbox[VB6]
Hi, is there any way to do this?
» Send a simple a name like "David" to the server and come back to the client insidea listbox? I have multiple connections running and I don't want IP addresses showing for security reasons....
» So it will be like when someone connects to the server it sends the nickname they put in a textbox to the server and come back to the client inside a listbox.
Thank You,
EnYcE :cool:
Re: Adding Nickname to Listbox[VB6]
Yes it is possible and there is not set way to do it, what you must think about is what is the logical way to do it?
You know how to send/recieve data so you need to determine a way to seperate usernames from chat, I personally would prefix the usernames with ¬ or somthing, then on recieving any data check that first character, if you have a look at any of the many examples I have posted here you will see this in action :)
Its one of them questions which doenst really have a ana nswer
Pino
Re: Adding Nickname to Listbox[VB6]
Hi, can you give me a name of the example you are talking about. Will be much easier to find it :)
Thanks,
EnYcE :coo:
Re: Adding Nickname to Listbox[VB6]
SOrry for double post...
But just wondering is it also possible to connect on a different form and then have another form connected as well to the server at the same time?
For example, in my program I'm trying to do this:
Connect on a form and then show a button to go to a different form where you can chat. But it always says that i'm not connected when I get to the chat form.
Thanks,
EnYcE
Re: Adding Nickname to Listbox[VB6]
Quote:
Originally Posted by EnYcE
SOrry for double post...
But just wondering is it also possible to connect on a different form and then have another form connected as well to the server at the same time?
For example, in my program I'm trying to do this:
Connect on a form and then show a button to go to a different form where you can chat. But it always says that i'm not connected when I get to the chat form.
Thanks,
EnYcE
How are you connecting on your first form?
Re: Adding Nickname to Listbox[VB6]
Well i have a connect button which does Winsock.Connect and I get connected then a button comes up for ENter Chat. Then when you click that button i do this, Form2.show. Then on my 2nd form I have all the DataArrival and Send stuff. Here's the code:
Code:
First Form:
Private Sub cmdConnect_Click()
Winsock.RemoteHost = txtHost.Text
Winsock.RemotePort = 10185
Winsock.Connect
lblConnect = "Connecting...."
cmdConnect.Enabled = False
cmdClose.Enabled = True
End If
End Sub
Private Sub Winsock_Connect()
lblConnect = "Connected to " & txtHost.Text & "."
txtNick.Enabled = False
cmdConnect.Enabled = False
cmdEnter.Visible = True
cmdEnter.Enabled = True
End Sub
Second Form:
DataArrival.......Send.........etc..
Hope this is what you asked for....
Re: Adding Nickname to Listbox[VB6]
Your winsock object is on your first form, not on your second. You cannot simply do something like Winsock.SendData txtChat.Text or something on your 2nd form, because the object isnt on the 2nd form -- try Form1.Winsock.SendData txtChat.Text -- where Form1 is the name of your first form. This way you are pointing to the winsock object on the other form, and not making visual basic think it's looking for an object called "Winsock" on your 2nd form. Hope this helps.