Does anyone know how to setup an UltraCombo to a default value ( say first row in a data set)
Thank You
Alex
Hi Alex,
Set the Value (or Text) property on the control.
Hi Mike
Thank You for the prompt response
.Text doesn't really work, it only displays the text value but I want the whole row. Here is a code snippet.
i bind my control like this
initialize(Infragistics.Win.UltraWinGrid.UltraCombo cboCtrl,...)
{...
cboCtrl.DataSource = oDataset.Tables[0];cboCtrl.DisplayMember = sDisplayColumn;cboCtrl.ValueMember = sValueMember;cboCtrl.AutoEdit = true;
...}
after form is initialized I want to be able to click on a button, say "View", and be able to see the value in cboCtrl ( say 6 columns )
so I do the following
Infragistics.Win.UltraWinGrid.UltraGridRow row = (Infragistics.Win.UltraWinGrid.UltraGridRow)cboCtrl.SelectedRow;
but unless user specifically clicks on ultraCombo I keep getting an exception.
Please Help
Regards
I'm not sure I understand the problem. If you set the Value of the Combo, this will also set the Text and the SelectedRow.
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?
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.
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 ?
Thanks,
Imran
Thanks Mike for your help, now it works for me.
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