C
c_shah
I am a beginner and learning VB.net
There are two wasy to bind a combobox or a listbox
First approach is to assign a datasource and displaymember
Second approach is to iterate through datarow collection
This works
With ComboPaymentType
.DataSource = dsComboItems.Tables("PaymentType")
.DisplayMember = "PaymentType"
.ValueMember = "PaymentTypeID"
End With
The second approach
Dim row As DataRow 'Represents a row of data in Systems.data.datatable
For Each row In dsComboItems.Tables("PaymentType").Rows
ComboPaymentType.Items.Add(row("PaymentType"))
Next
How to assign value propery (in my case "paymenttypeId" property as a
value of the combobox item) in the second approach?
There are two wasy to bind a combobox or a listbox
First approach is to assign a datasource and displaymember
Second approach is to iterate through datarow collection
This works
With ComboPaymentType
.DataSource = dsComboItems.Tables("PaymentType")
.DisplayMember = "PaymentType"
.ValueMember = "PaymentTypeID"
End With
The second approach
Dim row As DataRow 'Represents a row of data in Systems.data.datatable
For Each row In dsComboItems.Tables("PaymentType").Rows
ComboPaymentType.Items.Add(row("PaymentType"))
Next
How to assign value propery (in my case "paymenttypeId" property as a
value of the combobox item) in the second approach?