Thread: comboBox

  1. #1
    Registered User
    Join Date
    Sep 2010
    Posts
    41

    Lightbulb comboBox

    hi,
    i m working on a simple project, i want to populate my text boxes and comboBoxes through DataGridView, means when i double click on cell content then the text boxes are populated.my question is that if i have to populate comboBox with the specific value then what i have to do then because comboBox.selectedItem is an object but my class property is a string..
    e.g
    combobox shows 30 days in it and my class is
    Code:
    class account 
    {
         public string day{set;get}
    }
    in the main form:
    Code:
    list<account> mylist=new list<account>();
    public cellDoubleClick(eventsArgs e)
    {
         comboBox.selectedItem=mylist[e.rowIndex].day;
    }
    .......
    but that does not happen because "comboBox.selectedItem" is an object so if i have to do that what i have to do then?
    desperately looking for ur reply.
    thanku

  2. #2
    Registered User
    Join Date
    Jun 2003
    Posts
    129
    Is the combobox dropdownlist?
    He who asks is a fool for five minutes, but he who does not ask remains a fool forever.

    The fool wonders, the wise man asks. - Benjamin Disraeli

    There are no foolish questions and no man becomes a fool until he has stopped asking questions. Charles Steinmetz

  3. #3
    Registered User
    Join Date
    Sep 2010
    Posts
    41
    no this is dropdown

  4. #4
    Registered User
    Join Date
    Jun 2003
    Posts
    129
    Each object has the text contained in a property, iterate.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. combobox in c
    By kaliberon in forum Windows Programming
    Replies: 4
    Last Post: 12-24-2011, 09:18 AM
  2. Combobox in c
    By kaliberon in forum C Programming
    Replies: 2
    Last Post: 12-20-2011, 11:41 AM
  3. ComboBox Help
    By Jesse20ghet in forum C# Programming
    Replies: 3
    Last Post: 05-24-2011, 05:50 AM
  4. How to use ComboBox's
    By bikr692002 in forum C++ Programming
    Replies: 2
    Last Post: 04-08-2006, 09:09 PM
  5. Combobox help
    By Dohojar in forum Windows Programming
    Replies: 5
    Last Post: 04-15-2003, 07:02 AM