求助,设置按钮visible属性为false,不起作用

        string sq1 = string.Format("select * from dbo.sumupdate");
        DataSet ds1 = new DataSet();
        SqlDataAdapter da = new SqlDataAdapter(sq1, connection1);
        da.Fill(ds1, "dz");
     
        //判断是否有数据
        if (ds1.Tables["dz"].Rows.Count > 0)//如果包含该物料
        {
            this.Button1.Enabled = true;
            this.Button1.Visible = true;
            this.Button1.Text = "查看物料实时更新信息";
          
        }
        else
        {
            this.Button1.Visible = false;
            this.Button1.Text = "";
            this.Button1.Enabled = false;
        }

执行else时,button1一直显示,求助

你可能感兴趣的:(求助,设置按钮visible属性为false,不起作用)