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

 by twenglish1
Finished.JPG
In this instuctable i will show you how to make a simple chat program in visual basic. i will go over what all the code does so you will be learning as you make it, and at the end i will show you how to use it.
 
Remove these adsRemove these ads by Signing Up
1-40 of 227Next »
adityachavan142 says: May 8, 2013. 12:34 AM
its good but runtime error "object required" 424
adityachavan142 says: May 8, 2013. 12:32 AM
its good but error object required
Naitikkundalia says: Mar 29, 2013. 2:13 AM
I tried your code and it works fine so thank you for it.

I want to perform following task in your program :-
1)Group chat
2)Add smilies
3)Sending files

Please note that i don't want to make more changes

I use richtextbox in my program.

I request you to upload pdf to perform above task
Screamz332 says: Mar 23, 2013. 4:47 PM
I am still having trouble with the sckMain.GetData(Data, vbString) line, do you have any suggestions. I fixed the rest of the errors myself, but have no clue with this one.
mukeshdube says: Mar 6, 2013. 7:55 PM
when i click host and then connect runtime error 40020 occurrs how i can overcome this problem
adandoy says: Feb 11, 2013. 3:44 AM
thank you now i already know it...
t asdi says: Jan 17, 2013. 1:21 AM
when i click host and then connect runtime error 40020 occurrs how i can overcome this problem
t asdi says: Jan 17, 2013. 1:19 AM
when i click host and then connect runtime error 40020 occurrs how i can overcome this problem
essamabdallah says: Dec 16, 2012. 4:11 AM
thank you
rnvenkat says: Aug 20, 2012. 7:34 AM
operator '&' is not defined for types 'string' and 'system.windows.forms.textbox'

i am facing this problem in vb.net 2008

pls help me
purni2192 says: Aug 14, 2012. 7:55 AM
For the send command we get wrong protocol or connection state for the requested transaction,n for other commands v get a runtime error-424 object required..and no 2 forms appear here;pls help me in this...
othmanmohammed says: May 4, 2012. 3:04 AM
i can't download the tut pdf!!
Corliansa says: Apr 14, 2012. 11:07 PM
there is this word in front = "Run-Time Error '40006';
Corliansa says: Apr 14, 2012. 10:37 PM
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?
markjeggar says: Apr 10, 2012. 11:51 PM
A simple VB.NET chat program with source code

http://vb.net-informations.com/communications/vb.net_chat_server_program.htm

jeggr.
kumali says: Apr 7, 2012. 9:24 PM
is it working with at least 3 computers?
de7ox says: May 12, 2009. 8:34 PM
Hi, i am coding in VB2008, it worked so far but this part doesn't work @ all for me :

sckMain.state <> sckClose


sckMain.accept requestid


Please e-mail me with a solution asap as i really like this proggy u made!
de7ox@hotmail.com
Thanks!
jflores-3 in reply to de7oxMar 5, 2011. 5:28 PM
I created a chat program without winsock and its works
jflores-3 in reply to jflores-3Mar 11, 2011. 5:39 AM
the correct code is:If sckMain.CtlState <> 0 Then

sckMain.Accept(e.requestID)
sathiprady in reply to jflores-3Feb 28, 2012. 12:55 AM
how is it possible can you explain
twenglish1 (author) in reply to jflores-3Mar 5, 2011. 6:05 PM
How did you do it?
gurgle528 in reply to de7oxSep 13, 2010. 4:46 PM
Dim proCedure As String
sckMain.Close()
sckMain.Accept(e.requestID)
sckMain.Accept(e.requestID)
proCedure = txtLog.Text & "Connected to: " & sckMain.RemoteHostIP & vbCrLf
proCedure = txtLog.Text
you will need to fix the lines, but this is what I have.
RoboticProgrammer in reply to de7oxSep 22, 2009. 5:58 AM
Winsock1.Close() Winsock1.Accept(e.requestID)
twenglish1 (author) in reply to de7oxMay 13, 2009. 4:25 AM
i don't know how to get this program to work with VB2008 you need to make changes to the code, sorry
MunRa says: Feb 18, 2012. 9:09 AM
How to make the message sent to ListBox if use ENTER BUTTON on Keyboard?

Like chat aplication generally, example: Facebook chat.

Thanks
pradysathi says: Feb 13, 2012. 3:08 AM
Hai I tried to connect the chat(program which is developed in vb 6) with another system on the LAN. i am finding it hard to do so.kindly help me.
Hendro_Prayogo says: Jan 9, 2012. 10:42 PM
Sir ,
Error "40020" how come ?"
plese reply ..
:D
hyker69 says: Mar 3, 2010. 12:30 AM
mr twenglish when i run the program RUN TIME ERROR Occurs and says it Requires an Object how can i fix that?..pls reply until tommorow because im rushing our project tnx..pls teach me how to fix that problem..tnx again..

ark_anghel07 in reply to hyker69Jan 4, 2012. 4:09 PM
Successfull.. tnx
twenglish1 (author) in reply to hyker69Mar 3, 2010. 4:16 AM
you need to make sure you renamed all the objects correctly
embivert says: Oct 23, 2011. 1:52 AM
Hi,
I'm paras. I've never tried to run the above program but the way of describing the example is awesome.
Mochamaddhany says: Sep 29, 2011. 5:32 AM
I have run-time error "40020" invalid operation at current state
mhimebaugh says: Aug 30, 2011. 6:37 PM
Operator "&" is not defined for types "String" and "System.Windows.Forms.Textbox"
This message will appear when entering the code for cmdSend. This is the exact code I typed in
Private Sub cmdSend_Click()
sckMain.SendData("[" & txtName.Text & "]" & txtSend.Text)
txtLog = txtLog.Text & "[" & txtName & "]" & txtSend.Text & vbCrLf
txtSend.Text = ""
End Sub
mhimebaugh in reply to mhimebaughAug 30, 2011. 6:51 PM
Wait Nevermind i used a diffrent code it works now :P
вприске says: Jul 19, 2011. 8:37 AM
is it working in WAN i mean like skype or MSN?
twenglish1 (author) in reply to вприскеJul 19, 2011. 8:47 AM
i tried to figure out how to use this over WAN but i couldn't figure it out
msörhäll says: Jun 16, 2011. 7:53 AM
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.

Thanks!
jormsbee says: May 28, 2011. 2:39 PM
im on vista so i couldn't get visual basics 6 to work
jormsbee says: May 28, 2011. 2:39 PM
im on vista so i couldn't get visual basics 6 to work
jormsbee says: May 28, 2011. 2:37 PM
does anyone know about visual basics 2010? winsock ?
1-40 of 227Next »
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!