hi there,
i have the following on click button
private void buttonA_Click(object sender, EventArgs e){
if (something.Enabled == true){
// do something
} else{
// do something
}}
now i want to call this button from another button that i created
private
void buttonB_Click(object sender, EventArgs e){
buttonA_Click();
}
i get an error 'Error 1 No overload for method buttonA_Click' takes '0' arguments...
please help!
ShaniPosted Mar 8, 2009, 2:15 PM
But thanks anyways :) I have something else to ask you but I want to try couple of things before I grace your door for answer.
So I will get back to you on monday if I couldn't find the solution myself
Aleksandar IlioskiPosted Mar 7, 2009, 4:47 PM
Hi! Your question aren't the problem, their content is:), also my english is problem too :) ok lets try this way
if (MessageBox.Show("some text","caption",MessageBoxButtons.RetryCancel,MessageBoxIcon.Warning) == DialogResult.Retry)
{
// what ever you want for example:
this.PC_PRB.Checked = false;
this.Wall_PRB.Checked = false;
this.Other_PRB.Checked = false;
}
ShaniPosted Mar 6, 2009, 3:04 PM
yup makes sense. I forgot to make my eventhandler public. Thanks for your help!
I am sorry for keep bugging you with things. I am just very new with studio.
I have this..
MessageBox.Show("Only One option can be selected at one time!",
"Error", MessageBoxButtons.RetryCancel, MessageBoxIcon.Warning);what I want to do is that when i click on retry button...I want my checkboxes to get reset
before i had another button for reset
private void Reset_Options_Click(object sender, EventArgs e){
this.PC_PRB.Checked = false; this.Wall_PRB.Checked = false; this.Other_PRB.Checked = false;}
i think its more wise to have them reset when the user click on retry.
Please tell me how
thanks
Aleksandar IlioskiPosted Mar 6, 2009, 7:05 AM
As I try to understand you are looking for this
public
partial class Form2 : Form{
public Form2(){
InitializeComponent();
}
public void button1_Click(object sender, EventArgs e) // this metod should also be public by default it is private... and the button also should be public{
MessageBox.Show("Hello!");}
}
public
partial class Form1 : Form{
public Form1(){
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e){
Form2 frm2 = new Form2();frm2.button1_Click(
this, e);}
}
If this is not what you are askintg, feel free to ask again
ShaniPosted Mar 5, 2009, 5:03 PM
I did it some other way but thanks though
One thing i want to ask
I have two froms. lets say form A and B
I want to access controls from from A to form B
I changed the button settings to public
so it appreas on my form B
if (PC_PRB.Checked == true){
formA PRB_form = new formA();PRB_form.buttonA
}
buttonA appears but i want the click event of buttonA to appear not buttonA name if you get what i mean
please answer
thanks
Aleksandar IlioskiPosted Mar 4, 2009, 5:59 PM
private void buttonB_Click(object sender, EventArgs e)
{
buttonA_Click(this, e);// one way
}
private void buttonB_Click(object sender, EventArgs e)
{
buttonA.PerformClick(); // the other way
// hope thisl will help you
}