25-01-18, 08:55 AM
PHP كود :
Public Class Form1
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
For ono = 1 To 10
Dim Newbutton As New Button
Newbutton.Name = "Button" & ono
Newbutton.Top = (ono - 1) * Newbutton.Height
Controls.Add(Newbutton)
AddHandler Newbutton.Click, AddressOf nebe
Next
For Each c As Control In Me.Controls.OfType(Of Button)()
ListBox1.Items.Add(c.Name)
Next
ListBox1.Left = 100
End Sub
Private Sub nebe(ByVal sender As System.Object, ByVal e As EventArgs)
sender.Text = "باسل"
End Sub
Private Sub ListBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles ListBox1.SelectedIndexChanged
Dim c As Control = Controls(ListBox1.Text)
c.Text = "Basil"
End Sub
End Class

