Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Elegant Ribbon Tech Support » Combo box when created dynamcilly , the value can not be taken Collapse All
Subject Author Date
Omar Naser Nov 18, 2015 - 10:35 AM

Hello

I build combo box by code , and the item is one element

when this comb box created , and try to select this value , it will not be filled

Here is code
--------------------------------------------------------------------------------------
Private Sub btnCreateCombobox_Click(sender As System.Object, e As System.EventArgs) Handles btnCreateCombobox.Click
Dim dt As New Data.DataTable
dt.Columns.Add("Name")
dt.Columns.Add("ID")
dt.Rows.Add("Object Name", "Object ID")

Dim Ctrl As New Elegant.Ui.ComboBox()
Ctrl.Editable = False
Ctrl.DataSource = dt
Ctrl.DisplayMember = "Name"
Ctrl.ValueMember = "ID"
’Ctrl.SelectedIndex = 0 Here is give error ( first case )
Ctrl.SelectedValue = dt.Rows(0)("ID") ’ come empty ,slect value , you see can not take any value
Ctrl.Dock = DockStyle.Top

pnl.Controls.Add(Ctrl)
End Sub
-------------------------------------------------------------------------------------------


Iam using Elegant Ribbon V4.2

best regard
omar naser

Art Wilkes Nov 19, 2015 - 10:03 AM


Just add combobox in parent list of controls earlier to create the control window:

Dim Ctrl As New Elegant.Ui.ComboBox()
pnl.Controls.Add(Ctrl)
Ctrl.Editable = False
Ctrl.DataSource = dt
Ctrl.DisplayMember = "Name"
Ctrl.ValueMember = "ID"
’Ctrl.SelectedIndex = 0 Here is give error ( first case )
Ctrl.SelectedValue = dt.Rows(0)("ID") ’ come empty ,slect value , you see can not take any value
Ctrl.Dock = DockStyle.Top

is the correct order.

Art Wilkes Nov 18, 2015 - 10:55 AM

Thanks
We have asked support to look at this.
They normally reply in a day or tow.
ProfUIS