Hi,

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
Mohan.

Recommended Answers

All 2 Replies

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()
        Try

            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
                cmbId_Training.Items.Add(dtTraining.Rows(i).Item(0))
            Next

        Catch ex As Exception
            MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OKOnly, "Error Connection!!")
        End Try
        conn.Close()
    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...

commented: Excellent. +1

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.!!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.