Hi fellows, please help me on this..... here is my code. I use one form to search data to != forms using 'visible' validation, but i find this error.
" NullReferenceException was unhandled, Object reference not set to an instance of an object."
in one of the form needing data.....
public string IDSet
{
set { tb_IdFunc.Text = value; }
}
public string NomeSet
{
set { lbNomeFunc.Text = value; }
}
private void bt_Search_Click(object sender, EventArgs e)
{
if (tb_IdFunc.Text == "")
{
frmSearchFunc SF = new frmSearchFunc();
SF.Location = new System.Drawing.Point(CG.parameterXLocation(), CG.parameterYLocation());
SF.ShowDialog();
}
else
{
FuncDal.shearchFaltaID(this.lstFalta, this.dtDataFalta.Value.Month, this.dtDataFalta.Value.Year, Convert.ToInt32(this.tb_IdFunc.Text));
this.lbNomeFunc.Text = FuncDal.getFuncNam(this.tb_IdFunc.Text);
}
}
In search form.....
private void lstSearchFuncGeral_DoubleClick(object sender, EventArgs e)
{
//frmAtribuirFalta atribF = new frmAtribuirFalta();
frmAtribuirFalta atribF = (frmAtribuirFalta)Application.OpenForms["frmAtribuirFalta"];
configSubsidio cnfgSubs = (configSubsidio)Application.OpenForms["configSubsidio"];
try
{
if (atribF.Visible == true)
{
arrayDetail = FuncDal.FuncAllData(this.lstSearchFuncGeral.FocusedItem.SubItems[0].Text);
//nomeProp = arrayDetail[0].ToString().Trim() + " " + arrayDetail[17].ToString().Trim();
atribF.IDSet = dadosID;
atribF.NomeSet = dadosNome;
}
}
catch (Exception ex)
{
throw ex;
}
try
{
if (cnfgSubs.Visible == true)
{
arrayDetail = FuncDal.FuncAllData(this.lstSearchFuncGeral.FocusedItem.SubItems[0].Text);
cnfgSubs.IDSet = dadosID;
cnfgSubs.NomeSet = dadosNome;
}
}
catch (Exception ex)
{
throw ex;
}
this.Close();
}
Regards!