An object reference is required for the non-static field, method, or property 'login.add_reminder.textBox1'
i am getting this error. textbox is on other form. access modifire is public but still error. how to resolve this error.
private void ok_Click(object sender, EventArgs e)
{
SqlConnection my = new SqlConnection(@"Data Source=heaven_prince20;Initial Catalog=final_pr;Integrated Security=True");
my.Open();
SqlCommand cmd = new SqlCommand("INSERT INTO reminder(messaq,date,time) VALUES ('" + add_reminder.textBox1.Text + "''" + monthCalendar1.SelectionRange.Start + "','" + dateTimePicker1.Value + "')", my);
cmd.ExecuteNonQuery();
}
Loading

Iftikar HussainRank #423 · 5.9K reputationPosted Aug 10, 2013, 9:23 PM EDT
Regards,
Iftikar
Iftikar HussainRank #423 · 5.9K reputationPosted Aug 10, 2013, 9:03 PM EDT
What is add_reminder? Have you created the instance of this form?
Regards,
Iftikar
ta mu198 reputationPosted Aug 10, 2013, 9:04 PM EDT
Iftikar HussainRank #423 · 5.9K reputationPosted Aug 10, 2013, 9:08 PM EDT
Regards,
Iftikar
ta mu198 reputationPosted Aug 10, 2013, 9:18 PM EDT
ta mu198 reputationPosted Aug 10, 2013, 10:12 PM EDT
whats wrong
Iftikar HussainRank #423 · 5.9K reputationPosted Aug 10, 2013, 11:02 PM EDT
Regards,
Iftikar
ta mu198 reputationPosted Aug 10, 2013, 11:08 PM EDT