Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Loading A Combobox - With Code
Message
From
13/03/2003 21:15:32
 
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00765655
Message ID:
00765668
Views:
19
This message has been marked as a message which has helped to the initial question of the thread.
Kirk,

Your code looks ok to me ... nothing jumps out at me as glaringly wrong or anything. But, you'll have to remember that I do C#, not VB, so maybe I'm missing something subtle. Sorry, maybe someone else can jump in with some ideas.

Sorry I'm no help ... =(
~~Bonnie


>It does have data, I add code to get the count and it has 19 records, I moved the setting of the combobox to after the fill() and still no data. Still the combo doesn't load. Here is the newest code:
>
>
>        'Create a Connection
>        Dim Conn As SqlClient.SqlConnection
>        'gcConnString is a public variable in the Globals.vb file
>        Conn = New SqlClient.SqlConnection(gcConnString)
>
>        Dim cmd As New SqlClient.SqlCommand()
>        Dim da As New SqlClient.SqlDataAdapter()
>        Dim ds_AuthDepts As New Data.DataSet()
>        Dim cb As SqlClient.SqlCommandBuilder
>        Dim prm As SqlClient.SqlParameter
>
>        Try
>            cmd = Conn.CreateCommand
>            cmd.CommandText = "ct_lu_AuthorizedDeptsByUsers"
>            cmd.CommandType = CommandType.StoredProcedure
>            prm = cmd.Parameters.Add("@tiuserID", SqlDbType.Int)
>            prm.Value = gnUserID
>
>            da.SelectCommand = cmd
>            da.Fill(ds_AuthDepts, "Departments")
>
>            Dim lnCount As Integer
>            lnCount = Me.BindingContext(ds_AuthDepts, "Departments").Count
>
>
>            Me.ComboBox1.DataSource = Me.ds_AuthDepts.Tables("Departments")
>            Me.ComboBox1.DisplayMember = "DeptDesc"
>            Me.ComboBox1.ValueMember = "DeptID"
>
>            MsgBox(lnCount)
>
>
>
>        Catch ex As Exception
>            MsgBox("Error: " & ex.Message)
>        End Try
>
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform