Forms on top of forms

ALX

Well-known member
Joined
Nov 16, 2005
Messages
253
Location
Columbia, SC
Programming Experience
10+
Pop up erases listbox below...???

I'm a newbie to VB.net & am using visual studio.net 2003. My project includes two forms that each contain a listbox...
------------------------
Me.ListBox1.DrawMode =
System.Windows.Forms.DrawMode.OwnerDrawFixed
------------------------
The data in the listboxes are created via a graphics object.

I have small pop up windows (another form class) that appear occasionally on top of the full screen forms that contain the listboxes. In one instance, moving the smaller window (dragging it with the mouse) wipes out the listbox display as if the smaller form were an eraser. (I am not using Listbox1.BeginUpdate prior to calling the pop up). Only information after the previously selected item gets erased. This occurs even if I clear the selected items before calling the pop up window. In another instance (different form & listbox) the listbox below gets refreshed around the same smaller pop up window as it is moved around. Both instances and listboxes appear to be identical except for the information that they convey. 'Not a big issue, but it really looks tacky.
..... Any ideas on how to keep my listbox intact ?
 
Last edited:
ALX said:
The data in the listboxes are created via a graphics object.
Are you doing the drawing in the listbox's Paint event handler (or the listbox's Items Paint Event handler)?
The Paint event occurs when the object's graphics become invalid (another window in front of it for example). If the drawing isn't being done in the Paint Event Handler then the default graphics are drawn (nothing for example).
 
Sorry for wasting your time with this...
It appears that the problem was from using a global variable in the pop up window (...I know I shouldn't have...) which was changing a value that the parent form was also using.
I was under the impression that the form below was pretty much static at the point that another showdialog method was active on top. Apparently the listBox_DrawItem event fires for the parent form every time the top window is moved. It's wild trying to figure out what's going on behind the scenes in vb.NET. I'd like to find some literature that's better suited for me on programming vb.NET. The books I've bought are either overly simplistic or are over my head. Most vb.NET books assume that you are already familiar with VisualBasic 6. I haven't done any programming since QuickBasic. Surely there must be some books out there that teach vb.NET without having to first learn every version of Visual Basic just to find that most everything has changed with vb.NET anyway....
... Got any suggestions for vb.NET programming books that give a bottom-up approach that show more than "Hello World...?"
 
Back
Top