Question Locked

VB.NET Compact Framework ProblemTesting if a textbox is visible

0 helpful
6 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

CF .NET 2.0 on Mobile 5.0
If I set a textbox visible it becomes visible on the screen but when testing the value it is always false. I don't have the problem on Pocket PC (w/ same code)

textbox1.Visible = True
If textbox1.Visible = True Then
...do something
end if

Thanks, Josh

6 replies

by alan williams

A sinple solution is to use a global variable as a flag and test it, not the property.

Also you could try refreshing the form after setting the property.

by jbrown

Refresh didn't work. Global variable would work but its a bit messy. Testing the proberty worked is .NET 1.0 and the enabled property works. I'm assuming that its a bug in 2.0

by alan williams

Rather than using a global flag, try setting a value in the Taf property and using that as a test.
It is probably a bug, one of many.

by jbrown

It seems the problem only happens in the load event. In a button event it works, which makes me wonder why the refresh didn't work. In any case as long as its only in the load event I will just handle it with variables. Thanks for the help.

by alan williams

That explains it, the control does not exist until after the form is loaded. The Activate event occures after Load.

The Pocket PC code is incremental vbScript and builds the controls as it works through the code.

This discussion is closed to new replies.