An unhandled exception of type 'System.NullReferenceException' occurred in System.Windows.Forms.dll Additional information: Object reference not set to an instance of an object.
<pre>protected void Bind_Data() { try { Control.CheckForIllegalCrossThreadCalls = false; connect.connect.Open(); Thread.Sleep(500); MySqlCommand cmd = new MySqlCommand("SELECT * FROM table_A ORDER BY id ASC", connect.connect); MySqlDataAdapter sda = new MySqlDataAdapter(cmd); DataTable dt = new DataTable(); sda.Fill(dt); this.Datagridview.DataSource = dt; this.Datagridview.Columns["date_created"].Visible = false; this.Datagridview.Columns["Time"].Visible = false; connect.connect.Close(); count_DGV_lbl.Text = $"Total Records: {Datagridview.RowCount}"; } catch (Exception ex) { MessageBox.Show(ex.Message, "Warning Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
Control.CheckForIllegalCrossThreadCalls = false;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)