|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Sending button events programmatically
Suppose I have a button with the following code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click MessageBox.Show("I just got clicked!") End Sub If, for some reason, I want to send a button click event to Button1 programmatically without the user actually clicking on the button, how would I do it? I read about "RaiseEvent" and "WithEvents" and "Delegate", but it's rather confusing. |
|
#2
|
|||
|
|||
|
The following code in C#:
private void button1_Click(object sender, System.EventArgs e) { MessageBox.Show("hello"); } private void button2_Click(object sender, System.EventArgs e) { System.EventArgs f = new System.EventArgs(); this.button1_Click(this, f); } |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > .Net Development > Sending button events programmatically |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|