This is the second part of my how to create an instant messenger script with visual basic and php.
Please read the first part of the lesson before starting it. You can find link in the lesson or you can find it on this forum too :c-smile:
On Last Part We Have Created Our Main Form And Learnt How To Create Controls By Our Codes.
In This Part We Will Learn How To Make It Look Like A Instant Messenger.
At The End Of This Lesson, Our Main Form Will Be Like This;

Okay. So as you see in this picture;
We have some new objects in this lesson.
First, remove our old button and it's functions.
These are;
- 2 Panels. 1 Of Them Scrollable.
- 1 Statusbar
And i have added read friends from a php file. But it is on next part.
Okay. So We must reforge our form properties first.
So Change them this way;
- FormBorderStyle -> FixedSingle
- MaximizeBox -> False
- Name -> Hello! Welcome To vbChat
And add a StatusLabel Control to your strip.
Change it's properties like this;
- Name -> status
- BackColor -> Control
- Text -> Status

Okay. Now Create A Panel By These Properties;
- Name -> header_panel
- BackColor -> Wheat
- BorderStyle -> FixedSingle
- Dock -> Top
- Location -> 0;0 (Automatically)
- Size -> 344; 47
First Label
- Name -> welcome_label
- AutoSize -> On (Automatically)
- Font -> Trebuchet MS; 9,75pt; style=Bold
- Location -> 11; 8
- Text -> Welcome To vbChat!
- Name -> buddies_label
- AutoSize -> On (Automatically)
- Font -> Trebuchet MS; 9,75pt; style=Bold
- Location -> 163; 8
- Text -> Your Buddies;
Create A Panel On Your Form.
- Name -> friends
- AutoScroll -> True
- BackColor -> CornflowerBlue
- BorderStyle -> FixedSingle
- Dock -> None (Automatically)
- Location -> 0; 46
- Size -> 344; 401

Yes. You dont have Version Label =D
Now We Must Do Some Change In Our Code.
Create a function named add_buddy by these;
Private Function add_buddy(ByVal name As String, ByVal status As String)
Dim b As New Panel
b.Location = New System.Drawing.Point(25, (which * 62) + 12)
which += 1
b.Name = "Panel" & which
b.BorderStyle = BorderStyle.FixedSingle
b.Size = New System.Drawing.Size(290, 50)
b.TabIndex = which + 1
b.BackColor = Color.Cornsilk
friends.Controls.Add(b)
Dim c As New Label
c.Location = New System.Drawing.Point(40, 4)
c.AutoSize = True
Dim font As New Font("Trebuchet MS", 10, FontStyle.Regular)
c.Font = font
c.ForeColor = Color.DarkRed
c.Text = name
AddHandler c.MouseMove, AddressOf altciz
AddHandler c.MouseLeave, AddressOf altciz_kaldir
Dim d As New Label
d.Location = New System.Drawing.Point(45, 22)
d.AutoSize = True
d.Text = status
b.Controls.Add(c)
b.Controls.Add(d)
c.Visible = True
b.Visible = True
Return Nothing
End Function So, Old Version Was Adding The Controls Directly To Form. But This Is Adding It To The Panel With These Codes friends.Controls.Add(b)Well, You Can Test It By Typing These Codes To Your Form.Load Event;
For i As Integer = 0 To 10
add_buddy("Buddy Name", "Buddy Description")
Next Looks like that;
Right?
Just Keep Waiting For Next Part Of This Serie. We Will Contact With Internet And Add Buddies With The Information We Took From Internet.
Before This Dont Forget Installing XAMPP from Here for our tests if you dont have a host or something like that.
Thank you for reading my post.
You can find next parts and much more on this forum or on my site.


Sign In
Create Account

Back to top









