Part III - The Coding Begins
Stuff That Is Covered in Part III:
If you haven't read my first two parts to this tutorial, you should go here first and read them. During this part we start some basic coding of our chat program. There isn't much code relating to the Winsock control yet, but we need to set up the basic stuff before we begin. There will be a LOT of Winsock code next tutorial, I promise.
Starting off:
First, you should open up VB6. Create a new 'Standard EXE'. Here's what my screen looks like at this point. Click to enlarge the photo.

Lets start out by making the form look nice. The color scheme is based off of my site. Rename your form to frmStart. Set the BackColor to Black. Be sure that when you set the BackColor that Palette is selected and NOT System. System colors can vary between systems, so to make sure that the colors say the same between computers, use the Palette. This is true for any other coloring changing you do in VB. Change these properties.
Name frmStart
BackColor Black
BorderStyle 1 - Fixed Single
Caption EasyChat v1.0 - Login
Height 4620
ScaleMode 3 - Pixel
StartUpPosition 3 - CenterScreen
Width 8250
Add some controls:
Add a label somewhere on your form. It doesnt matter what size it is, the properties you enter will put it in its proper place and its proper size.
Name Label1
BackColor Black
Caption EasyChat v1.0
Font BankGothic Md BT, Bold, 28 (you need to open up the font dialog)
ForeColor &H0015FF15& (you need to type this in, its not on the Palette)
Height 81
Left 72
Top 8
Width 401
Below is a pic of what it should look like:

Add the two options:
Again, you can place these anywhere on the screen. The properties will put them where they are supposed to be.
Name Option1
BackColor Black
Caption Start a chat room
Font Verdana, Regular, 10
Height 17
Left 64
Top 64
Value True (marks this option on the screen)
Width 201
Name Option2
BackColor Black
Caption Join a char room.
Font Verdana, Regular, 10
Height 17
Left 64
Top 80
Width 201
Here is a picture of while I was setting all of the properties for the two Option controls.

Here is another pic:

Add the Winsock control:
Add the Winsock control to your form. Don't change its name. You can place the control anywhere you want on the form, it is invisible during run-time. I placed mine right next to the EachChat v1.0 label.
Add some more important controls:
We need to add just a few more controls before we start writing some code.
Name Label2
BackColor Black
Caption "" (make sure Caption has nothing in it.)
Font Verdana, Regular, 10
ForeColor Blue (select the darkest one)
Height 17
Left 32
Top 136
Width 137
Name Label3
BackColor Black
Caption ""
Font Verdana, Regular, 10
ForeColor Blue
Height 17
Left 32
Top 136
Visible False
Width 137
Name Text1
Font Verdana, Regualr, 10
Height 19
Left 176
Text ""
Top 136
Visible False
Width 113
Name Label4
BackColor Black
Caption CLICK HERE TO START
Font BankGothic Md BT, Bold, 36
ForeColor Yellow (pick the brightest one in the palette)
Height 89
Left 72
Top 176
Width 401
Finally some code:
We are now ALL DONE with all the properties. Here is what it should look like completed:

Double click your form and get ready to add some code:
Place this code in Form_Load():
'Lets start out with filling in Label2
Label2.Caption = "Your IP Address is: " & Winsock1.LocalIP
'This puts the IP address of your computer in the label.
Put this code in Option1_Click():
'We don't need to enter an IP address when we are the server.
'Make that part of the form invisible.
Label2.Visible = True
Label3.Visible = False
Text1.Visible = False
Put this code in Option2_Click():
'We don't need to know our IP address when we are connecting
'to someone else. Make that invisible.
Label2.Visible = False
Label3.Visible = True
Text1.Visible = True
You can download a ZIP file of all the files needed for the project so far. If its not uploaded yet, I'm making the zip file as we speak. The Part IV is coming soon; we will be writing a lot more Winsock related code.

