hey ya all
my question is simple, how to simulate an event by code, for example consider a simple form which has 2 buttons. button1 changes the forms color, now i want the code that i should put in click event of button2 that when i click it the app thinks that i have clicked button1 and thus changes the form's color as if i have clicked button1.
thanks guys...
DeathEater
0
Light Poster
Recommended Answers
Jump to PostEvents can only be raised from the class that declared them (even derived class' cannot invoke them). Luckily WPF/Forms controls implement protected methods to allow derived classes to do this. Just derive from the Button class, and call OnClick(), for example:
public MyButton : Button { public …
Jump to PostYou don't need to simulate a key press. You could just set
maskedTextBox.SelectionStart = 0;
andmaskedTextBox.SelectionLength = 0;
.
All 8 Replies
nmaillet
97
Posting Whiz in Training
DeathEater
0
Light Poster
nmaillet
97
Posting Whiz in Training
DeathEater
0
Light Poster
nmaillet
97
Posting Whiz in Training
DeathEater
0
Light Poster
nmaillet
97
Posting Whiz in Training
DeathEater
0
Light Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.