更新时间:2023-11-30 15:34:58
检查一下: populatedropdown-vb [ ^ ]
试试这个
我 .cmd_Customer.DataValueField = CUST_NUMBER
我 .cmd_Customer.Databind()
我 .cmd_Customer.Items.Add( CUST_NUMBER)
Hi,
me.combobox.databind应该是最后一个声明并且有效
I have a dropdownlist control and i am trying to add items from a database at runtime. but the items are not loading. this is the code I wrotePrivate Sub Load_customer()
Dim objdatas As DataSet
Dim retrievas As New GenBizData.Customer_Class
objdatas = retrievas.CUSTFILE_SHOWALL2
Me.cmd_Customer.DataSource = objdatas.Tables("CUSTFILE")
Me.cmd_Customer.DataTextField = "CUST_NAME"
Me.cmd_Customer.DataValueField = "CUST_NUMBER"
Me.cmd_Customer.Items.Add("CUST_NUMBER")
End Sub
Check this out: populatedropdown-vb[^]
Try this
Me.cmd_Customer.DataValueField = "CUST_NUMBER"
Me.cmd_Customer.Databind()
Me.cmd_Customer.Items.Add("CUST_NUMBER")
Thanks I found the answer.
me.combobox.databind should be the last statement and it worked