Friday, October 27, 2006

Insert graphic objects dynamically

A word document is available in this address:

http://www.box.net/public/irqldpcze3

Important things:

1. Create, set and add to Controls; new graphic objects:

' Set up some properties for the TextBox
btnSpeakText.Text = "Speak Text"
btnSpeakText.Name = "btnSpeakText"
btnSpeakText.Location = New Point(m_Location.X + 250, m_Location.Y)
btnSpeakText.Size = New Size(100, btnSpeakText.Height)
' Add the previously created TextBox to this button
btnSpeakText.Tag = txtSpeakText
' Add the TextBox to the controls collection.
Controls.Add(btnSpeakText)

2.- Work with msgBox specific(OK):

MsgBox("You've reached 5 controls. Clear controls to start again.", _
MsgBoxStyle.OkOnly, Me.Text)

3.- Join Handles and subrutines:

AddHandler btnSpeakText.Click, AddressOf SpeakTextClickHandler

4.- Ask for the sort of object:

If TypeOf sender Is Button Then
End If

5.- Castings:

Dim myButton As Button = CType(sender, Button)

0 Comments:

Post a Comment

<< Home