8
Answers

textbox value

Ask a question
ta mu

ta mu

11y
1k
1
 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();

  }



Answers (8)