Referencing object of same name

T

tsluu

public class form1

Private WithEvents Appt As Calendar.Apptmnt

Private Sub Panel2_MouseDoubleClick(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles Panel2.MouseDoubleClick
static idx as integer
Appt = New Calendar.Apptmnt
Appt.Name = idx
idx = idx + 1

Panel2.Controls.Add(Appt)

AddHandler Appt.MouseUp, AddressOf Appt_myMouseUp
AddHandler Appt.MouseDown, AddressOf Appt_myMouseDown
AddHandler Appt.MouseMove, AddressOf Appt_myMouseMove
End Sub

Based on the above code, how do I refer to individual Appt when I want to
reference them during mouse_move event. I know how to reference the current
one I clicked, that is by using DirectCast in the event. But how about the
ones that are not in focus.
 
C

Cor Ligthert[MVP]

You have made it private on global level of your class, therefore appt is
accessible in your complete class.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top