meine Aufgabenstellung ist folgende:
Ich fülle ein Grid mit x zeilen und binde in jede Zeile der Spalte 2 eine Combobox ein.
Diese werden per Datenbindung gefüllt
Code: Select all
mycbo = New ComboBox
With mycbo
.DataSource = dt
.DisplayMember = "Pk_Name"
.ValueMember = "Pk_ID"
.DropDownStyle = ComboBoxStyle.DropDownList
End With
myGrid.Cells(2, i).ControlDisplayInfo.Control = mycbo
myGrid.Cells(2, i).ControlDisplayInfo.PropertyName = "SelectedItem"
mycbo = New ComboBox
With mycbo
.DataSource = dt
.DisplayMember = "Pk_Name"
.ValueMember = "Pk_ID"
.DropDownStyle = ComboBoxStyle.DropDownList
End With
myGrid.Cells(2, i).ControlEditInfo.Control = mycbo
myGrid.Cells(2, i).ControlEditInfo.PropertyName = "SelectedItem"
Jedoch will es mir nicht gelingen, nach dem Füllen der Comboboxen die SelectedValue Eigenschaft zu setzen um so einen Eintrag per Value vorzuwählen.
Wenn ich z.B.
Code: Select all
myCbo.SelectedValue = 2
Wie kann ich dies erreichen?
Ich benutze Visual Studio 2005 und ppsGrid Version 1.3.4.1
Danke schon mal im vorraus
Mirko