Creating additional forms during runtime and assigning them controls is easy, as well as assigning them handlers, just how do you access these forms and their controls from their handlers. The way I'm coding, the handlers don't recognize them. Nothing happens during mouse down and move.
Really appreciate some help. :)
Below handlers are for the new form, but I would also like to know how to use handlers for created controls.
Really appreciate some help. :)
Code:
Dim form2 As New Form
form2.Show(Me)
form2.Text = "Form2"
form2.BackColor = Color.White
form2.Width = Me.Width
form2.Height = Me.Height
form2.Location = New Point((Me.Location.X + Me.Width), Me.Location.Y)
AddHandler form2.MouseDown, AddressOf Form2_MouseDown
AddHandler form2.MouseMove, AddressOf form2_MouseMove
AddHandler form2.MouseUp, AddressOf form2_MouseUpCode:
Private Sub Form2_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
form2.width = 200 'Example code I know doesn't work
End Sub
Private Sub Form2_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove
End Sub
Private Sub Form2_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseUp
End Sub