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...?

Re: Weird If/Then Ghost..Needs messagebox.show to activate by Daniel

Daniel
Thu Apr 28 04:55:33 CDT 2005

Post a complete sample that I can run here.

Cheers
Daniel
--
http://www.danielmoth.com/Blog/


"Blarney" <crumb_stone@yahoo.com> wrote in message
news:1114619220.884150.259020@f14g2000cwb.googlegroups.com...
>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...?
>