H
hexathioorthooxalate
All, I appear to have a mind block at the moment. Could someone help me out
and get me over this hurdle.
1. Create a new VB.Net 2003 project with form1 open.
2. Drop a "button1" onto the form.
3. Paste in the code below.
When repeatNo is 0, I see the 6th button selected as expected. When repeatNo
is >0, it isn't. For goodness sakes, why?
Thank you
Hexathioorthooxalate
Public Class Form1
Inherits System.Windows.Forms.Form
'+ Windows Form Designer generated code
Private Class btnExtend
Inherits Button
End Class
Private Sub clearButtons()
For Each o As Object In Me.Controls
If TypeOf o Is btnExtend Then Me.Controls.Remove(o)
Next
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Dim btn As Button
For repeatNo As Integer = 0 To 5
clearButtons()
For buttonCounter As Integer = 0 To 9
btn = New Button
btn.Size = New Size(10, 10)
btn.Top = 20
btn.Left = buttonCounter * 15
Me.Controls.Add(btn)
If buttonCounter = 5 Then btn.Select()
Next buttonCounter
MsgBox("complete" + repeatNo.ToString())
Next repeatNo
End Sub
End Class
and get me over this hurdle.
1. Create a new VB.Net 2003 project with form1 open.
2. Drop a "button1" onto the form.
3. Paste in the code below.
When repeatNo is 0, I see the 6th button selected as expected. When repeatNo
is >0, it isn't. For goodness sakes, why?
Thank you
Hexathioorthooxalate
Public Class Form1
Inherits System.Windows.Forms.Form
'+ Windows Form Designer generated code
Private Class btnExtend
Inherits Button
End Class
Private Sub clearButtons()
For Each o As Object In Me.Controls
If TypeOf o Is btnExtend Then Me.Controls.Remove(o)
Next
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Dim btn As Button
For repeatNo As Integer = 0 To 5
clearButtons()
For buttonCounter As Integer = 0 To 9
btn = New Button
btn.Size = New Size(10, 10)
btn.Top = 20
btn.Left = buttonCounter * 15
Me.Controls.Add(btn)
If buttonCounter = 5 Then btn.Select()
Next buttonCounter
MsgBox("complete" + repeatNo.ToString())
Next repeatNo
End Sub
End Class