public void save_sheet(ref DataTable dtPad) ///Adds the rows to the table/// { DataRow nrPad; nrPad = dtPad.NewRow(); nrPad["Title"] = textBox1.Text; nrPad["Short Description"] = textBox2.Text; nrPad["Long Description"] = textBox3.Text; nrPad["Category"] = comboBox1.Text; nrPad["Date Set"] = dateTimePicker1.Value; nrPad["Date Saved"] = System.DateTime.Now; nrPad["Text"] = textBox4.Text; dtPad.Rows.Add(nrPad); }
private void saveToolStripMenuItem_Click(object sender, EventArgs e) ///Save Sheet Menu Item/// { { if (check_data() == (true)) { if (MessageBox.Show("Do you want to save?", "Notepad", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { save_sheet(ref dtPad); } } else { } }
Error 1 The name 'dtPad' does not exist in the current context Error 2 The best overloaded method match for 'Simple_Notepad.Form1.save_sheet(ref System.Data.DataTable)' has some invalid argumentsError 3 Argument '1': cannot convert from 'ref dtPad' to 'ref System.Data.DataTable'