使用一个eventclick填充两个工具. [英] Populating two tools with one eventclick.
问题描述
到目前为止,单击单选按钮填充listbox1的WINDOWSFORM代码工作正常.代码如下,
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();
}
以上工作正常.
现在,我想在单击同一单选按钮(AutoradioButton1_Click
)时从另一个表的特定列填充checkedlistbox1
.即(在一个AutoradioButton1_Click
上有两个填充)
任何人都可以在代码方面帮助我..或在代码中包含适当的代码.?
作为起点.
我的另一张表说:table1,列名:Rating.
谢谢
Vista
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
推荐答案
我看不到您的问题在哪里.只需获取值并设置复选框即可.它真的很容易.如果必须执行其他查询,请执行查询.
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.
这篇关于使用一个eventclick填充两个工具.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!