Bind Enum to Combobox


/ Published in: VB.NET
Save to your folder(s)



Copy this code and paste it in your HTML
  1. Dim query = From n As Integer In [Enum].GetValues(GetType(DialogResult))
  2. Select New With {n, .Valor = [Enum].GetName(GetType(DialogResult), n)}
  3.  
  4. ComboBox1.DataSource = query.ToList()
  5. ComboBox1.DisplayMember = "Valor"
  6. ComboBox1.ValueMember = "n"

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.