Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Senior Coder
    Join Date
    Aug 2005
    Posts
    1,119
    Thanks
    2
    Thanked 1 Time in 1 Post

    c# simple combobox

    Okay, So I have a ComboBox named mycombo with 2 options, "string1" and "string2".

    I have a form with a button that when they click the button it validates the form.

    All my question is, is simply how do I get the text of what they choose.

    Something like:
    Code:
    string choice = mycombo.SelectedText
    if (choice == "string1")
    {// blah blah blah
    }
    or string choice = mycombo.SelectedItem.ToString();

    However, none of them work, they all end up blank or throwing an error of sorts. I'm sure its something really quite simple, but for the life of me I can't figure it out.
    Last edited by thesavior; 06-30-2008 at 08:34 AM.

  • #2
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    mycombo.Text
    OracleGuy


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •