Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi I have combobox. I have bound it to datatable (or to arraylist. Does it make a difference?)

 

       'combo with DataTable datasource
       Me.ComboBox1.DataSource = myDataTable    
       Me.ComboBox1.DisplayMember = "DisplayMember"
       Me.ComboBox1.ValueMember = "ValueMember"
       
       'combo with ArrayList datasource
       Me.ComboBox2.DataSource = myArrayList   
       Me.ComboBox2.DisplayMember = "DisplayMember"
       Me.ComboBox2.ValueMember = "ValueMember"

 

my problem is, that I can still write in this combo (i can write a value/text that is not listed in dropdown list. I want, that user can only select values in dropdown list. How can I do that, and does solution depend on datasource type? (I'd prefer solution with arraylist).

 

 

tx a lot, matej

Posted

OK, I fugured solution:

It doesn't metter what kind of datasource I use. I just have to change dropdownstyle property.

ComboBox.DropDownStyle = ComboBoxStyle.DropDownList

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...