I have an ultra combo box that is populate with a table, the table only has one column coming back from sql. I added a row to the table via dataView a row with a value of "*ALL" and i want this value to be selected without having to click on the dropdown at all. when i debug it it with giving me " Object reference not set to an instance of an object." when trying the grab that initial value and assign it to a sql parameterized variable. im trying to set the initial value using setInitialValue. i understand that there is two parameters when using that function an object and a string for display. i dont really know what to put as object. any help would be appreciated. i know ther "0" is incorrect, i tried other items but i dont really know what to put. i try to assign the sql parameter this way in a differenct method : dbConn("@Group") = GroupCBox.SelectedRow.Cells("GroupWO").Text
Private Sub LoadGroupComboBox()
Dim ds As DataSet
Dim populateGroup As New PopCBoxes
ds = populateGroup.PopGroupIDs
'adding all option row item.
Dim row As DataRow
row = ds.Tables(0).NewRow
row("GroupWO") = "*ALL"
ds.Tables(0).Rows.Add(row)
'resorting the table utilizing dataView then referencing it in the ultracombo control.
Dim dataView As New DataView(ds.Tables(0))
dataView.Sort = "GroupWO ASC"
Dim dataTable As DataTable = dataView.ToTable()
If Not IsNothing(dataTable) Then
GroupCBox.DataSource = dataTable
GroupCBox.DisplayLayout.Bands(0).Columns(0).Header.Caption = "Groups"
End If
GroupCBox.SetInitialValue(0, "*ALL")
Hello Giovanni,
You can use the UltraCombo’s SelectedRow property, which determines the currently selected row from the dropdown and will automatically append its value to the combo’s text box.
I tried to reproduce your steps and I have created a sample project that uses a datatable as a data source. Then I add an empty row with title “All” to the DataTable and insert it at index 0, so that it will appear at the top of the dropdown. After that, I set the newly created dataView as DataSource of the ComboBox. At the end, I set the SelectedRow to the newly created row (which is on index 0) and when I run the application, ‘All’ is being selected in the UltraCombo by default.
Please let me know if you need further assistance regarding this matter.