Link to home
Start Free TrialLog in
Avatar of 6784
6784

asked on

Object reference not set to an instance of an object.

Can yoy guys look at this very basic code and tell my I get this error.


Line 1583:            'End If
Line 1584:
Line 1585:            If ddlCashAccount.SelectedItem.Text = "" Then
Line 1586:
Line 1587:                strScript = "<script>"


[NullReferenceException: Object reference not set to an instance of an object.]
   iVMF.wfmMain.MissingRequiredFields() in c:\inetpub\wwwroot\VB\iVMF\wfmMain.aspx.vb:1585
   iVMF.wfmMain.btnVMSave_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\VB\iVMF\wfmMain.aspx.vb:1895
   System.Web.UI.WebControls.Button.OnClick(EventArgs e)
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
   System.Web.UI.Page.ProcessRequestMain()






If ddlCashAccount.SelectedItem.Text = "" Then

                strScript = "<script>"

                strScript = strScript & "alert('Invaild Cash Account! Cash Account is mandatory on Vendor Company tab.');"

                strScript = strScript & "</script>"

                Page.RegisterStartupScript("ClientScript", strScript.ToString())

                Exit Function
            End If


I seem to be getting alot of these errors

6784

ASKER CERTIFIED SOLUTION
Avatar of Dabas
Dabas
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of 6784
6784

ASKER

Dabas,

Yes, that could very well be the problem. I'm stepping through the vaildation code, without entering any data or selecting any items in the ddls.

Thanks for the quick response.

6784