[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 188
  • Last Modified:

Disabling submit button until the user selects something from the drop down

I am working on windows application.I have a from where the user can submit it, only if he selects whom he wants to submit the form....i am using combo box here....ant suggestions on how to do this!
Thanks in advance.....
0
yuvaratna
Asked:
yuvaratna
  • 3
  • 3
1 Solution
 
guru_samiCommented:
did you try SelectedIndexChanged
private void comboBox1_SelectedIndexChanged(Object sender,  System.EventArgs e)
    {  Submitbtn.Enabled = "false";
}
0
 
yuvaratnaAuthor Commented:
nope! this is not working in the way i wanted! if i set Submitbtn.Enabled = false then the button is being enbabled first time i mean when the form loads and when the  combo box index is changed...it is being disabled!
0
 
guru_samiCommented:
sorry ... i misinterperted...
On formLoad button should be disabled.
Then in SelectedIndexChanged you set it enabled:
Submitbtn.Enabled = "true";

Please share more info or any code ..if you are having any trouble.

0
Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

 
guru_samiCommented:
Sample code:
private void Form1_Load(object sender, EventArgs e)
        {
            btnSubmit.Enabled = false;
            comboBox1.Items.Add("SelectOne");
            comboBox1.Items.Add("one");
            comboBox1.Items.Add("two");
            comboBox1.Items.Add("Three");
            comboBox1.SelectedIndex = 0;
 
        }
 
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (comboBox1.SelectedIndex != 0)
            {
                btnSubmit.Enabled = true;
            }
 
        }

Open in new window

0
 
yuvaratnaAuthor Commented:
Thanks a lot!!!!!!!!!!

Give me a min, i ll see if it works the way i wanted.....i am sure it works!!!!!
0
 
yuvaratnaAuthor Commented:
Perfect!
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now