I'm trying to access the value of resulterr in button clickevent in order to display it in the messagebox. I'm not getting the value inside the button click event despite setting resulterr list as public. I'm getting exception as object reference not set to an instance of an object. Please rectify the error.
public List<ErrorMsgTemplate> resulterr;
public PPFCWCFServiceClient ppfcObj = new PPFCWCFServiceClient();
public Admin()
: base("Administration")
{
SplashScreenManager.ShowDefaultWaitForm();
InitializeComponent();
GetSource();
ErrorMsg();
FillDivision();
cmbDivision.SelectedIndex = -1;
SplashScreenManager.CloseDefaultWaitForm();
}
public void ErrorMsg()
{
List<ErrorMsgTemplate> resulterr = ppfcObj.getErrorMsgTemplate("ADMIN");
}
private void btnSave_Click(object sender, EventArgs e)
{
try
{
if (cmbDivision.SelectedIndex == -1) //naray added
{
MessageBox.Show(resulterr[0].ERROR_MESSAGE_TEMPLATE.ToString() + "," + resulterr[0].SCREEN_NM.ToString(), "PPFC");
}