1个组合框与不同的数据集绑定 [英] 1 combobox bind with different Dataset

查看:57
本文介绍了1个组合框与不同的数据集绑定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友,
我正在用C#开发窗口应用程序.
我有2个单选按钮.和1个组合框.
我想将组合框与其他2个数据集绑定,具体取决于单选按钮上的选中状态.

谁能帮我吗?

谢谢.

hello friends,
I m developing window app in c# .
I have 2 radiobutton. and 1 combobox.
I want to bind combobox with different 2 dataset depends on checked on radiobutton.

Can anyone help me please?

THANKS IN ADVANCE.

推荐答案

您可以使用单选按钮的CheckedChanged事件


combobox的DataSource属性
:-D
you can use CheckedChanged event of radio button


DataSource property of combobox
:-D


写条件类似
write condition something like
private void RadioButton_CheckedChanged(object sender, System.EventArgs e)
{
  if (sender is RadioButton)
  {
    RadioButton radiobutton = sender as RadioButton;
    if (radiobutton.Checked)
    {
      comboBox1.DataSource = DataSet1;
    }
    else
    {
      comboBox1.DataSource = DataSet2;
    }

  }
}


这篇关于1个组合框与不同的数据集绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆