Combobox Woes

This is a discussion on Combobox Woes within the C# Programming forums, part of the General Programming Boards category; Hey All, I have added at combobox Dropdownlist and added the list of values that i wanted to it about ...

  1. #1
    Registered User
    Join Date
    Sep 2008
    Posts
    1

    Question Combobox Woes

    Hey All,

    I have added at combobox Dropdownlist and added the list of values that i wanted to it about 13 in all {300, 600,1200,1800 ...} . The problem i am having is that when the code runs the initial value in the combobox is blank i would like 300 in this case to be the initial value.

    Any idea on how to do that ? I know this seems to be a basic question but i cant find the answer high up or low down.

    Code:
    // Braud_comboBox1
                // 
                this.Braud_comboBox1.DisplayMember = "1";
                this.Braud_comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
                this.Braud_comboBox1.FormattingEnabled = true;
                this.Braud_comboBox1.Items.AddRange(new object[] {
                "300",
                "600",
                "1200",
                "1800",
                "2400",
                "3600",
                "4800",
                "7200",
                "9600",
                "19200",
                "28800",
                "38400",
                "57600",
                "115200"});
                this.Braud_comboBox1.Location = new System.Drawing.Point(106, 53);
                this.Braud_comboBox1.Name = "Braud_comboBox1";
                this.Braud_comboBox1.Size = new System.Drawing.Size(155, 21);
                this.Braud_comboBox1.TabIndex = 1;
                //

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    My hat of guessing wonders what DisplayMember = "1" means in this case -- nothing I've found about DisplayMember seems to match this usage. My suggestion is to take it out (it appears to be optional) and see what happens.

  3. #3
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    After adding the items, call Braud_comboBox1.SelectedIndex = 0;
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. textBox, comboBox
    By Coding in forum C# Programming
    Replies: 4
    Last Post: 02-16-2008, 09:53 PM
  2. Trouble Adding to ComboBox (*not* an LB_ issue..)
    By roblarky in forum Windows Programming
    Replies: 1
    Last Post: 07-18-2007, 12:27 PM
  3. Ugh, ComboBox Woes
    By Zeusbwr in forum Windows Programming
    Replies: 11
    Last Post: 04-12-2005, 12:14 AM
  4. combobox reacts strangely to a mouse
    By johny145 in forum Windows Programming
    Replies: 2
    Last Post: 03-07-2005, 05:32 PM
  5. Win32 COMBOBOX 'Enter' Key??
    By tdk_ratboy in forum Windows Programming
    Replies: 0
    Last Post: 04-17-2004, 06:52 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21