小编Enr*_*iko的帖子

为什么会冻结?

我的目标是让我的按钮灵活,取决于我的组合框的当前值,但问题是当我在该特定事件上运行我的程序它冻结,我的语法有问题或我的电脑只是慢?

private void cmbOperation_SelectedIndexChanged(object sender, EventArgs e)
{
    string selected = (string)cmbOperation.SelectedItem;

    while (selected == "ADD")
    {
        txtID.ReadOnly = true;
        txtLName.ReadOnly = false;
        txtFName.ReadOnly = false;
        txtMI.ReadOnly = false;
        txtGender.ReadOnly = false;
        txtAge.ReadOnly = false;
        txtContact.ReadOnly = false;

        btnOperate.Text = "ADD CLIENT";
    }
}
private void btnOperation_Clicked(object sender, EventArgs e)
{            
    if (cmbOperation.SelectedItem.Equals("ADD"))
    {
        string constring = "datasource=localhost;port3306;username=root";
        string Query = "insert into mybusiness.client_list (LastName,FirstName,MI,Gender,Age,Contact) values('" + this.txtLName.Text + "','" + this.txtFName.Text + "','" + this.txtMI.Text + "','" + this.txtGender.Text …
Run Code Online (Sandbox Code Playgroud)

c# combobox selectedindexchanged click button

0
推荐指数
1
解决办法
136
查看次数

标签 统计

button ×1

c# ×1

click ×1

combobox ×1

selectedindexchanged ×1