how to get datagridview selected row value to textbox,radiobutton and dropdownlist which is in another windows form c# for up date
getting this error(Object reference not set to an instance of an object.)
this is my form1 code
--------------------------
public static string Gender, Division, Genre, Event, Scoreeve, Relay,Note,Selectmode;
public static int Rounds, Scoreteam, timeprecison, Advancement
public frmAddEditEvents()
{
if (Selectmode == "update")
fillRecord();
if (Selectmode == "insert")
InitializeComponent();
}
public void fillRecord()
{
rdbMale.Text = Gender;
cmbDivison.Text = Division;
rdbRun.Text = Genre;
cmbEvent.Text = Event;
chkScore.Text = Scoreeve;
chkRelay.Text = Relay;
nudRounds.Value = Rounds;
nudScores.Value = Scoreteam;
nudTimeprecision.Value = timeprecison;
txtEventnote.Text = Note;
numericUpDown1.Value = Advancement;
btnSave.Text = "update";
}
this is form 2
-------------------------
private void tsbtnEdit_Click(object sender, EventArgs e)
{
if (grdEvents.SelectedRows.Count > 0)
{
frmAddEditEvents.Selectmode = "update";
frmAddEditEvents.Gender = Convert.ToString(grdEvents.SelectedRows[0].Cells[1].Value);
frmAddEditEvents.Division = Convert.ToString(grdEvents.SelectedRows[0].Cells[2].Value);
frmAddEditEvents.Genre = Convert.ToString(grdEvents.SelectedRows[0].Cells[3].Value);
frmAddEditEvents.Event = Convert.ToString(grdEvents.SelectedRows[0].Cells[4].Value);
frmAddEditEvents.Scoreeve = Convert.ToString(grdEvents.SelectedRows[0].Cells[5].Value);
frmAddEditEvents.Relay = Convert.ToString(grdEvents.SelectedRows[0].Cells[6].Value);
frmAddEditEvents.Rounds = Convert.ToInt16(grdEvents.SelectedRows[0].Cells[7].Value);
frmAddEditEvents.Scoreteam = Convert.ToInt16(grdEvents.SelectedRows[0].Cells[8].Value);
frmAddEditEvents.timeprecison = Convert.ToInt16(grdEvents.SelectedRows[0].Cells[9].Value);
frmAddEditEvents.Note = Convert.ToString(grdEvents.SelectedRows[0].Cells[10].Value);
frmAddEditEvents.Advancement = Convert.ToInt16(grdEvents.SelectedRows[0].Cells[11].Value);
frmAddEditEvents obj = new frmAddEditEvents();
obj.ShowDialog();
return;
}
else
{
MessageBox.Show("Please select any record to update");
}
}