.Net Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - More.Net Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old March 14th, 2004, 07:02 PM
timzter timzter is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 63 timzter User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 2 m 39 sec
Reputation Power: 6
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.

Reply With Quote
  #2  
Old March 16th, 2004, 10:50 AM
siplnettech siplnettech is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 14 siplnettech User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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);
}

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - More.Net Development > Sending button events programmatically


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT