With this code, a combobox is bound very simply with 2 items:
PartBCombo = New List(Of PartBBilling_Combobox)() From { _ New PartBBilling_Combobox() With { _ .PartBLookup_CPTCode = "D0001", .PartBLookup_ProcedureDescription = "test" _ }, New PartBBilling_Combobox With { _ .PartBLookup_CPTCode = "D2222", .PartBLookup_ProcedureDescription = "Another test" _ } }
How do I change this to bind with database values?
I tried this code but only the very last database row is bound:
If Reader.HasRows Then While Reader.Read() PartBCombo = New List(Of PartBBilling_Combobox)() From { _ New PartBBilling_Combobox() With { _ .PartBLookup_CPTCode = Reader("CPT").ToString, .PartBLookup_ProcedureDescription = Reader("ProcedureName").ToString }} End While End If
I'm assuming the "New List(Of..." code just overwrites the previous rows. I get compile errors if I take out the "New..".
Class definition:
Public Property PartBCombo As List(Of PartBBilling_Combobox) Get Return _PartBCombo End Get Set(value As List(Of PartBBilling_Combobox)) _PartBCombo = value End Set End Property Private _PartBCombo As List(Of PartBBilling_Combobox)
Thanks.