Fill Dropdown List box From Dataset
-
Does anyone know how to fill Dropdown list boxes from the dataset on form load? I really need some pointers, and in advance I appreciate the help. :doh: Treacherous_1
-
Does anyone know how to fill Dropdown list boxes from the dataset on form load? I really need some pointers, and in advance I appreciate the help. :doh: Treacherous_1
Sure I have a video out there that I made for my CIS 410 class. Let me know if you have problems seeing it. http://www.jasncab.com/devry/cis410 The idea is that you fill the dataset then bind to the Dim ds As DataSet Dim strSQL As String Dim strResult As String strSQL = "select rollid, rollid || '-' || description || ' ' || rolldate as descdate from qa_rollouts " 'FILL THE DATASET REMOVED _ ADD BACK IN cboRollouts.DataTextField = "descdate" cboRollouts.DataValueField = "rollid" cboRollouts.DataSource = ds cboRollouts.DataBind() ds.Dispose() ds = Nothing Really with anything in form load you want to make sure that you wrap your binding code inside of a ispostback. If you dont you will either overwrite what was there or add to it. Usually it isnt a good idea to leave the ispostback off. Also enabling viewstate has caused confusing depending on what you expect. http://www.jasncab.com/huberblog :: Jason Huber
-
Does anyone know how to fill Dropdown list boxes from the dataset on form load? I really need some pointers, and in advance I appreciate the help. :doh: Treacherous_1
ListBox1.DataTextField = "TextField" ListBox1.DataValueField = "ValueField" ListBox1.DataSource = dataset ListBox1.DataBind()