Weird If/Then Ghost..Needs messagebox.show to activate

  • Thread starter Thread starter Blarney
  • Start date Start date
B

Blarney

I just started having the strangest problems with 2 of my If Then
statements. They are pretty basic and have been working for months,
but this week they stopped "DOING" stuff unless I preceed each one with
a messagebox.show statement! :? If I insert a messagebox before the
following code, it runs flawlessly. Remove the messagebox and it fails
with a sql error due to it not closing the database as seen in the
second part of the if/then....

Example:

If strName <> "" Then
MenuItem1.Enabled = False
MenuItem11.Enabled = False
pnlCheck.Location = New Point(0, 0)
pnlCheck.Visible = True
pnlCheck.BringToFront()

Else
cn.Close()
LoadTree()
DTR2.Close()
End If

The code above does NOT run the first part of the if statement unless I
preceed it with a messagebox.show. I spent all day Monday coding
around one of these if then statements and now this one has popped up.


I have tried all sorts of "silent" ways to get past this that wouldn't
involve a messagebox.show such as setting hidden labels to the
variables, and goofy stuff like disabling hidden textboxes, etc. but
nothing except for a messagebox seems to make the If/Then statement
run.

Weird stuff? Or...?
 
Back
Top