combobox的bug问题再开第二贴,不信没有高手,为了说明问题,已将所有数据在内存中构建,麻烦您在开发环境粘一下看看
public partial class Form2 : Form
{
DataTable comboBoxDataTable = new DataTable();
DataTable inputDataTable = new DataTable();
static int ii = 0;
public Form2()
{
InitializeComponent();
//设定数据录入表
inputDataTable.Columns.Add( "nsr_swjg_dm ", typeof(string));
inputDataTable.Columns.Add( "swjg_mc ", typeof(string));
//初始化数据源
sb_zsxxBindingSource.DataSource = inputDataTable.DefaultView;
sb_zsxxDataGridView.DataSource = this.sb_zsxxBindingSource;
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
if (sb_zsxxBindingSource.Position > = 0)
{
//如果没有inputDataTable.Rows[sb_zsxxBindingSource.Position][ "SWJG_MC "] = this.comboBox1.Text;
//这句,那么下面这句是能正常执行的
this.textBox1.Text = this.comboBox1.Text;
//加上以下这句不仅不能执行,而且comboBox1不能选择上任何一项
inputDataTable.Rows[sb_zsxxBindingSource.Position][ "SWJG_MC "] = this.comboBox1.Text;
}
}
private void Form2_Load(object sender, EventArgs e)
{