Click here to Skip to main content
15,881,898 members
Home / Discussions / C#
   

C#

 
AnswerRe: help ? Pin
leppie25-Sep-02 12:56
leppie25-Sep-02 12:56 
GeneralOpening Excel workbook Pin
Donald Blachly25-Sep-02 10:26
Donald Blachly25-Sep-02 10:26 
GeneralRe: Opening Excel workbook Pin
Stephane Rodriguez.25-Sep-02 21:11
Stephane Rodriguez.25-Sep-02 21:11 
GeneralRe: Opening Excel workbook Pin
Donald Blachly26-Sep-02 3:50
Donald Blachly26-Sep-02 3:50 
QuestionHow to activate event procedure Pin
D Shen25-Sep-02 9:42
D Shen25-Sep-02 9:42 
AnswerRe: How to activate event procedure Pin
leppie25-Sep-02 9:57
leppie25-Sep-02 9:57 
GeneralRe: How to activate event procedure Pin
D Shen25-Sep-02 10:51
D Shen25-Sep-02 10:51 
GeneralRe: How to activate event procedure Pin
leppie25-Sep-02 11:55
leppie25-Sep-02 11:55 
D Shen wrote:
I am not sure if I understand what you mean by

It's the beauty of inheritance Smile | :)

OK. Lets see how/why I say that Smile | :)

1. What we want is a button that we can programatically fire events. It makes sense to add this functionality to the Button class. So we make one:

public class ButtonEx():System.Windows.Forms.Button
{
  public void CallButtonclick()
  {
    base.OnClick(EventArgs.Empty); // sorry mistake in first post :)
  }
}

2. We replace our existing Button in the in the form with our new ButtonEx.

private System.Windows.Forms.Button button1; //now becomes
private ButtonEx button1;

And in the windows forms designer region, change :
button1 = new System.Windows.Forms.Button(); //now changes to
button1 = new ButtonEx();

Be sure to save before viewing in the designer(in fact close it beforehand, it does more harm than good Laugh | :laugh: ).

3. Finally we just call our new ButtonEx's CallButtonClick methods as follows:

button1.CallButtonClick();


NOTE: If you'll be calling this method from thread u will need to invoke it. I'm not 100% sure, but it would look something like this:

button1.Invoke( new MethodInvoker(button1.CallButtonClick));


Hope this adds some insight Smile | :)

Give them a chance! Do it for the kittens, dear God, the kittens!
GeneralRe: How to activate event procedure Pin
D Shen26-Sep-02 3:50
D Shen26-Sep-02 3:50 
GeneralRe: How to activate event procedure Pin
D Shen26-Sep-02 4:15
D Shen26-Sep-02 4:15 
GeneralRe: How to activate event procedure Pin
D Shen26-Sep-02 4:26
D Shen26-Sep-02 4:26 
GeneralRe: How to activate event procedure Pin
leppie26-Sep-02 7:17
leppie26-Sep-02 7:17 
GeneralRe: How to activate event procedure Pin
leppie25-Sep-02 12:08
leppie25-Sep-02 12:08 
Questionmultiple search patterns with Directory.GetFiles? Pin
Wjousts25-Sep-02 9:41
Wjousts25-Sep-02 9:41 
AnswerRe: multiple search patterns with Directory.GetFiles? Pin
Paul Riley25-Sep-02 10:29
Paul Riley25-Sep-02 10:29 
GeneralHere is a tough one - DataGrid throwing exception while repainting Pin
Luis Alonso Ramos25-Sep-02 7:25
Luis Alonso Ramos25-Sep-02 7:25 
GeneralRe: Here is a tough one - DataGrid throwing exception while repainting Pin
leppie25-Sep-02 7:45
leppie25-Sep-02 7:45 
GeneralRe: Here is a tough one - DataGrid throwing exception while repainting Pin
Luis Alonso Ramos25-Sep-02 9:05
Luis Alonso Ramos25-Sep-02 9:05 
GeneralRe: Here is a tough one - DataGrid throwing exception while repainting Pin
leppie25-Sep-02 9:20
leppie25-Sep-02 9:20 
GeneralRe: Here is a tough one - DataGrid throwing exception while repainting Pin
Luis Alonso Ramos26-Sep-02 5:31
Luis Alonso Ramos26-Sep-02 5:31 
GeneralOpenFileDialog slowing me down?! Pin
Zombies with Coffee, LLC25-Sep-02 6:41
professionalZombies with Coffee, LLC25-Sep-02 6:41 
GeneralRe: Slow function calls when no breakpoint set?! Pin
leppie25-Sep-02 7:03
leppie25-Sep-02 7:03 
GeneralRe: Slow function calls when no breakpoint set?! Pin
Zombies with Coffee, LLC25-Sep-02 8:14
professionalZombies with Coffee, LLC25-Sep-02 8:14 
GeneralRe: Slow function calls when no breakpoint set?! Pin
Zombies with Coffee, LLC25-Sep-02 8:34
professionalZombies with Coffee, LLC25-Sep-02 8:34 
GeneralRe: Slow function calls when no breakpoint set?! Pin
Zombies with Coffee, LLC25-Sep-02 9:09
professionalZombies with Coffee, LLC25-Sep-02 9:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.