1aliff
1aliff

Reputation: 445

c# button 2 can only be click after button 1 clicked

I am really new to C# and visual studio

My situation here is I have 2 button where button1_click (to do some processing) and button2_click (to go to next process)

What i want to ask, is it possible to do something like, to set button2_click can only be clicked only after the user click the button1_click at first..

Thanks for your reply!

Upvotes: 2

Views: 779

Answers (2)

sujith karivelil
sujith karivelil

Reputation: 29036

Yes it is possible, to do this you have to disable the Button2 initially and then enable that inside the Click event of Button1; Something like the following:

private void Button1_Click(object sender, EventArgs e)
{
   if("some condition if needed")
   {
       Button2.Enabled = true;
   }
}

Make sure that Button2 is disabled initially or else include this Button2.Enabled = false; in the page/form load

Upvotes: 5

BWA
BWA

Reputation: 5764

Set button2 enabled property to false. And in button1_click event handler set button2 enabled property to true.

Upvotes: 3

Related Questions