2

I have a Datagridview with a column that has a combobox as editing control. Say I choose value X in the combobox in the first row. When I open the combobox in row 2 it will select value X as default (when the combobox was empty before edit), even if value X isn't the first item in the list of the combobox. Why doesn't it select the first item (if it wants to select an item anyway)?

I don't know if it is relevant, but the grid and the combo are bound to Linq2sql objects.

Roland Deschain
  • 659
  • 11
  • 21
  • 2
    If you select value "Y" in row 2, then drop down the box in row 1: is "Y" selected? What I mean is: are you using only one datasource for the combobox? – Stephan Keller Aug 22 '11 at 14:16
  • @stephan-keller No what I mean is: I start editing row 1 and select Y as value in the combo. Then I add a new row (row 2) in which the combo at first is emmpty, but when I want to change the value it will jump to value Y. I can change it to another value, without effecting row 1, but I think it's kinda weird. – Roland Deschain Aug 23 '11 at 07:03
  • I'm guessing you don't specify any defaults anywhere? – Paul C Aug 23 '11 at 09:13
  • True. Because a value is not required for this field, I don't want to set a default value. – Roland Deschain Aug 23 '11 at 10:32
  • Did you try setting up the "selecteditem" property of the combobox to "" or to null in the beginning of the edit row event? – Greg Oks Aug 31 '12 at 12:58

0 Answers0