Click here to Skip to main content
16,017,726 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

So far WINDOWSFORM code to populate a listbox1 on clicking a radio button is working fine.. code as follows,

private void AutoradioButton1_Click(object sender, EventArgs e)
{
    SqlConnection conn = new SqlConnection("Server=CHRIS-PC\\SQLEXPRESS;Database=Tblcat;" +
                         "Integrated Security=True");
    SqlCommand scmd = new SqlCommand("SELECT Description FROM Moviecat", conn);
    DataSet sds = new DataSet();
    conn.Open();
    SqlDataAdapter sadptr = new SqlDataAdapter(scmd);
    sadptr.Fill(sds, "Moviecat");
    if (sds.Tables["Moviecat"].Rows.Count == 0)
    {
        MessageBox.Show("There are no DB.");
    }
    else
    {
        this.listBox1.DataSource = sds.Tables["Moviecat"];
        this.listBox1.DisplayMember = "Description";
    }
    conn.Close();
}


The above works fine.

Now i want to populate checkedlistbox1 from a particular column from another table, on clicking the same radio button ( AutoradioButton1_Click).. ie( two population on one AutoradioButton1_Click)

can anyone help me with the code.. or include appropriate code with it.?
as where to start.

My another table say: table1, and column name : Rating.

Thanks
Vista
Posted
Updated 20-Sep-10 0:02am
v2

1 solution

I don't see where your problem is. Just get the value and set the checkbox. It really is that easy. If you have to preform another query, then perform the query.
 
Share this answer
 
Comments
Vista007 20-Sep-10 7:01am    
I have tryed.. but not working.. can you give appropriate code.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900