lukis 0 Newbie Poster

Hi there,

I am currently working on my thesis and i came up with a problem. basically, my thesis is a simulation of an arena where you can change the positioning (by dragging) of the seating etc. Now i used labels as seats. I'm attaching the code i used to enable dragging

Dim dragging As Boolean
Dim startx, starty As Integer

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
 
Private Sub lblseat_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles lblseat.MouseDown
dragging = True
startx = e.X
starty = e.Y
End Sub
Private Sub lblseat_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles lblseat.MouseMove
If dragging = True Then
lblseat.Left = (lblseat.Left + e.X) - startx
lblseat.Top = (lblseat.Top + e.Y) - starty
End If
End Sub
 
Private Sub lblseat_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles lblseat.MouseUp
dragging = False
End Sub

Now i need to create labels during runtime. I know how to do that with the me.labels.add(variable).
I need help with assigning the dragging mode to the labels. I presume i have to use addhandler but i have no idea with regards to coding....

any help very much appreciated.

thanks
Luke

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.