How to make a simple chat program in visual basic using the Microsoft Winsock Control

Step 7: Using the program/Conclusion

Picture of Using the program/Conclusion
ok now im going to tell you how to use the program

in visual basic click file then make project1.exe save it to your desktop
if there are any errors leave a comment and i will try to help you

now go to where you made the program and double click it twice and two programs should pop up
on one click host and on the other click connect and on the one you clicked host on it should say: Connected to:

now type in a name for both of them and you can send messages between the two

it works on LAN and it might work on WAN but im not sure

leave comments letting me know how i did or if you have questions or if you just feel like it
if you liked it or didn't like it rate it
1-40 of 69Next »
RajeshS66 months ago

I am running my chat application on 3 computers. but they are not connecting. how should I set IP and port address of both server side and client side computers.

benzjoshua.labang made it!7 months ago

thank you!

benzjoshua.labang made it!7 months ago

thank you!

ankita081 year ago

this is working very well in the same pc and thanx a lot for that but i've tried to make it work on two but was not able to do so. can you plz tell me the way how to do it?

palavesam912 years ago
every thing should be done but finally have a runtime error as "object required 424"
its good but runtime error "object required" 424
its good but error object required
t asdi2 years ago
when i click host and then connect runtime error 40020 occurrs how i can overcome this problem
Corliansa3 years ago
there is this word in front = "Run-Time Error '40006';
Corliansa3 years ago
I can't when i click "Send" button it give this message = "Wrong Protocol Or Connection State For The Requested Transaction Or Request" can you fix it?
I have run-time error "40020" invalid operation at current state
is it working in WAN i mean like skype or MSN?
twenglish1 (author)  вприске4 years ago
i tried to figure out how to use this over WAN but i couldn't figure it out
msörhäll4 years ago
I need help.
EVERYTHING is working fine, but I want it so when you're active in the txtSend window, and press Enter/Return, it's the same as clicking Send.

So, when I click enter, it will send the message I've typed in the txtSend box.

jeff0326904 years ago
i have an error...kindly please help me..
Argument not optional

Private Sub CMDSEND_Click()
Me.SCKMAIN.SendData = "(" & Me.TXTNAME.Text & ")" & Me.TXTSEND.Text

twenglish1 (author)  jeff0326904 years ago
are you using visual basic 6.0?
twenglish1 (author)  jeff0326904 years ago
i don't see anything wrong with your code
then what should i do..?
i tried adding Microsoft Winsock but it wasn't in the list. what do i do??
find it fin and find until you find it
kevin-a1016 years ago
PS...im using Visual basic 2008 or 2005...ones at school ones at home (2008).. if u can give me a link to download vb 6.0 i would gladly install that if it helps
twenglish1 (author)  kevin-a1016 years ago
ok you can't use 2008 or 2005 you need 6.0 and i can't give you a link to download it cause you need to buy it(there are sites where you can download it but its illegal). and you can you 2005 and 2008 i think but i don't know how
ok i have no problem getting it im buying it i should have it in a little but..like i said im probably gonna need you to teach me some stuff im new with connecting the program to servers
twenglish1 (author)  kevin-a1016 years ago
ok no problem i'll help you. and this program acts as its own server. like one you click host, and it will become the server. and on the other one you click connect and it connects to the server if you entered the ip and port that the server is on
ok still downloading but as u can see im monitering posts
twenglish1 (author)  kevin-a1016 years ago
ok. where did you get it? just curios
ok that failed but i managed to find winsock control in both 2005 and 2008 so would i be able to do it from there?
twenglish1 (author)  kevin-a1016 years ago
yah it should work, where is it i can't find it
during making .exe file, there is an compile error "variable not defined" on line sckClose. how can i elliminate this
ive also managed to put it in my toolbox aand add it to a form if u want i can tell u how so u can tell everyone else 6.0 is basically impossible to get now and 2005 and 2008 are available free as express editions
twenglish1 (author)  kevin-a1016 years ago
how do you do it. and i have seen 6.0 on torrent sites and also in portable editions
okay hold on srry i havent been on in a while been trying to implement this chat program to see if it works in 2008 and 2005...it does...in order to do it u have to go into tools then choose toolbox items...then a screen pops up with 2 tabs click com componentsthen scroll down to find "microsoft WinSock Control 6.0 (sp4)
twenglish1 (author)  kevin-a1016 years ago
ok thanks does the same code work??
ok im gonna start typnig in next comment cant see what im typing its too far over
nadimos154 years ago
hello there twinglish i did all the steps and everything seems to be ok except for the last step when i double click on project1 , an empty vb window appears i click on run tab then start to run the program , the program runs but only one appears not 2 as u mentioned so whats the problem so far ? thank u so much
twenglish1 (author)  nadimos154 years ago
Did you made the EXE file?
pallabi5 years ago
 hii...i am trying to make a chat application in my website which is unde construction....i tried urs but unfortunately it s showing "runtime error 404"...............help me...its urgent
twenglish1 (author)  pallabi5 years ago
i don't think this can be used on websites
I make this then programm and also maked its .exe but if i use or connect  it  to the another lan computer then it will show an error.
I maked sure to me as i maked and use it as same of  the illustrated on this site after but when i use it , it will show a error. please try to fix this!!!!! 

run time error '424'
object required
1-40 of 69Next »