Does anyone know how to setup an UltraCombo to a default value ( say first row in a data set)
Thank You
Alex
Thanks Mike for your help, now it works for me.
Thanks,
Imran
Hi Imran,
So you want the set the value without the event firing? You could just use a flag to ignore the event handler. Or even disconnect the event and re-hook it after you set the SelectedIndex.
Try RemoveHandler Me.UltraComboEditor1.ValueChanged, AddressOf Me.UltraComboEditor1_ValueChanged Me.UltraComboEditor1.SelectedIndex = ZERO Finally AddHandler Me.UltraComboEditor1.ValueChanged, AddressOf Me.UltraComboEditor1_ValueChanged End Try
Hello Mike,
I want when my form loads, the UltraComboBox should be displaying first value from data source.
Following way I can achieve
Dim dsDataSet As DataSet Try dsDataSet = getDataSet() If dsDataSet .Tables.Count > ZERO AndAlso dsDataSet .Tables(ZERO).Rows.Count > ZERO Then ultraComboEditor.DataSource = dsDataSet
ultraComboEditor.DataMember = dsDataSet .Tables(ZERO).TableName
ultraComboEditor.DisplayMember = "DISPLAYNAME"
ultraComboEditor.ValueMember = "ValueCode" ultraComboEditor.SelectedIndex = ZERO End If
But catch in this way is that while loading it fires "ultraComboEditor_ValueChanged" Event when code execute following line
ultraComboEditor.SelectedIndex = ZERO
Is there any other way that when ultraComboEditor loads, it should be initialize with value from dsDataSet ?
Make sure you are setting the Value on the control AFTER you set it's DataSource, DataMember, ValueMember, and DisplayMember.
Also, I think there is an InitialValue property or maybe a SetInitialValue method that might help you here.
When can I set this Value property. I am linking the combobox to a UltraDataSource that I have populated in the designer so it is unlinked from any kind of database.
In the Form_Load event I try to set the Value to one that is in the list but it is not selected, when the page is displayed.
Where does this line need to be if I want the a specific value selected only when the page is first loaded and not each time the combobox receives an Initialization event?