P
Patrick A
All,
I am displaying a context menu when the user right-clicks one of 20
buttons that are created in code (code below).
I would like
What's the simplest, most accurate way to pass an attribute of the
button (like.name) that the user right=clicked to the context menu?
Thanks,
Patrick
Code:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Me.QRY_ButtonsTableAdapter.Fill(Me.SRTimerDataSet.QRY_Buttons)
Dim Row As Integer = 0
Dim ButLbls = SRTimerDataSet.Tables
("QRY_Buttons").AsEnumerable
()
Dim sortedButLbls = From tp In ButLbls _
Select tp _
Order By tp("TimerPos")
For Each tp In sortedButLbls
Row = Row + 1 'Increment up.
Dim NewButton As New MyButton() ' Sets a new button
NewButton.Width = 123 ' Sets the width.
NewButton.Height = 42 ' Sets the height.
NewButton.Top = 1 + (42 * Row - 1) ' Positions the top
of the button.
Me.Controls.Add(NewButton) 'Adds the new button to the
form.
NewButton.Name = (tp!TimerPos)
NewButton.Text = (tp!butLabel)
AddHandler NewButton.Click, AddressOf ButtonResponder
oTimeSliceCollection.Add(NewButton, tp
("TimerPos").ToString)
Next
I am displaying a context menu when the user right-clicks one of 20
buttons that are created in code (code below).
I would like
What's the simplest, most accurate way to pass an attribute of the
button (like.name) that the user right=clicked to the context menu?
Thanks,
Patrick
Code:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Me.QRY_ButtonsTableAdapter.Fill(Me.SRTimerDataSet.QRY_Buttons)
Dim Row As Integer = 0
Dim ButLbls = SRTimerDataSet.Tables
("QRY_Buttons").AsEnumerable
()
Dim sortedButLbls = From tp In ButLbls _
Select tp _
Order By tp("TimerPos")
For Each tp In sortedButLbls
Row = Row + 1 'Increment up.
Dim NewButton As New MyButton() ' Sets a new button
NewButton.Width = 123 ' Sets the width.
NewButton.Height = 42 ' Sets the height.
NewButton.Top = 1 + (42 * Row - 1) ' Positions the top
of the button.
Me.Controls.Add(NewButton) 'Adds the new button to the
form.
NewButton.Name = (tp!TimerPos)
NewButton.Text = (tp!butLabel)
AddHandler NewButton.Click, AddressOf ButtonResponder
oTimeSliceCollection.Add(NewButton, tp
("TimerPos").ToString)
Next