Please have a look at my attachments...

I wanted to know how this can be acheieved....

I want to bind some colums of my database table with various controls (ex. TextBoxes) and then some of the other colums to a LISTBOX or COMBOBOX.....

I know that I can bind individual column wid Textboxes, which is easy....juzz drag and drop..

Please let me know how I can bind some of the columns with one LISTBOX or COMBOBOX..???

ANy help would be appreciated.

Please have a look at my attachment... I want columns Day1, Day2, Day3,Day4,Day5 to be ound with a Listbox. and the rest are fine wid the text boxes....
Thank You

Attachments database_table.PNG 2.12 KB Form.PNG 18.53 KB
9 Years
Discussion Span
Last Post by brightmohan

what db that u using?
if u use sql server 2000, try this following code :
this code will fill the combobox ..

Private Sub BacaData()
        Dim i As Integer
        Dim cmdTraining As New SqlCommand
        Dim daTraining As New SqlDataAdapter
        Dim dsTraining As New DataSet
        Dim dtTraining As New DataTable
        Dim conn As SqlConnection

        conn = GetConnect()

            cmdTraining = conn.CreateCommand
            cmdTraining.CommandText = "SELECT * FROM Training"
            daTraining.SelectCommand = cmdTraining
            daTraining.Fill(dsTraining, "Training")
            dtTraining = dsTraining.Tables("Training")
            For i = 0 To dtTraining.Rows.Count - 1

        Catch ex As Exception
            MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OKOnly, "Error Connection!!")
        End Try
    End Sub

if u using list box u can change "cmbId_Training.Items.Add(dtTraining.Rows(i).Item(0))" with this one "ListBox1.Items.Add(dtTraining.Rows(i).Item(0))".

hope this helps...

Votes + Comments

Thank you, I will try to implement it...and see..if it works or, I'm trying.....to do zERO code kind of programming....where I dont have o write the code, and just do it using data wizard and add query kind of features... I love Microsoft for the ease of use that .NET comes wid.!!!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.