Link to home
Start Free TrialLog in
Avatar of PeterErhard
PeterErhard

asked on

MDI form Error

I'm getting the following error occasionally when I load my initial MDI form:

"Object reference not set to an instance of an object".

It happens on the following line of code:

            frmMain.ActiveForm.Text = "Centre : " & BranchName & " (" & UserCentre & "); User: " UserFullName & " (" & LCase(Username) & ")"

It doesn't happen all the time the application is loaded which makes it very hard to figure out why the eroror is occuring. Does anyone have any ideas?
Avatar of eekj
eekj

break the line down into
frmMain.ActiveForm.Text = "Centre : "
frmMain.ActiveForm.Text = frmMain.ActiveForm.Text + BranchName
frmMain.ActiveForm.Text = frmMain.ActiveForm.Text + " (" + UserCentre
.... etc

to find out which variable isnt getting initialised properly.
ASKER CERTIFIED SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America 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 PeterErhard

ASKER

Thanks for that - appears to have worked!