P
Patrick A
All,
I am using the code below (started from a sample from this group,
I think) to programmatically create a series of buttons in a vertical
strip on a form on Form Open.
I have a context menu which appears when the user right-clicks any
button on the form.
How do I "tell" the context menu (really a function on the context
menu) which button was right-clicked? I know how to get button
attributes when the user left-clicks...but that's not what I need...
Is there a way to do this?
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 using the code below (started from a sample from this group,
I think) to programmatically create a series of buttons in a vertical
strip on a form on Form Open.
I have a context menu which appears when the user right-clicks any
button on the form.
How do I "tell" the context menu (really a function on the context
menu) which button was right-clicked? I know how to get button
attributes when the user left-clicks...but that's not what I need...
Is there a way to do this?
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