I have a combobox that is consist of 'Male' and 'Female' selection. I have a datagridview that when double click, will go to another form which is named 'Edit Form'. I need to be ale to change whether the value is a male or female, but there is a problem. Whenever I try to set the combobox to a dropdownlist, it treats the 'Male' value as 6 characters as if all values inside of the combobox is adjusted to correspond to the length of the longest text.

I can't set the combobox selected text as 'Male' but can only be done with 'Male ', which becomes 6 characters.

Recommended Answers

I just created a form with a combobox, set it to dropdownlist and added 'male', 'female' to it. When I select 'male' the text is 4 characters long, 'female' it's 6. It must be something you are doing.

How is the combobox populated?

Jump to Post

All 3 Replies

I don't why it's automatically adjusting its length. I'm using combobox set to dropdownlist.

I just created a form with a combobox, set it to dropdownlist and added 'male', 'female' to it. When I select 'male' the text is 4 characters long, 'female' it's 6. It must be something you are doing.

How is the combobox populated?

Items.Add("Male")
items.Add("Female")

then insert to database using combobox.Text

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.