错误自动滚动'最小'和'最大' c #datagridview winform

时间:2016-09-14 18:03:12

标签: c# winforms datagridview

        try
        {
            string MyConnectionsss = "datasource=localhost;port=3306;Initial Catalog = 'svms';username=svms;password=svms2016CPU";
            string Query = "select * from userinformation";
            MySqlConnection MyConn2sss = new MySqlConnection(MyConnectionsss);
            MySqlCommand MyCommand2 = new MySqlCommand(Query, MyConn2sss);
            MySqlDataAdapter MyAdapter = new MySqlDataAdapter();
            MyAdapter.SelectCommand = MyCommand2;
            DataTable dTable = new DataTable();
            MyAdapter.Fill(dTable);
            metroGrid1.DataSource = dTable;
            metroGrid1.PerformLayout();
            metroGrid1.Columns["UserPassword"].Visible = false;     
        }
        catch (Exception ex)
        {
            MetroMessageBox.Show(this, ex.Message, "MySQL says:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
        }

如果我输入此代码" metroGrid1.Columns [" UserPassword"],则会显示错误.Visible = false;"我已经尝试过metroGrid1.PerformLayout();在滚动事件。仍然不起作用。希望有人能请求帮助。谢谢!

0 个答案:

没有答案