Visual Basic .net - Form loading
-
I am in the process of converting a project from vb6 to vb.net. Code is now re-written and I can run it. The first thing I see is that when I select and option to load a form from my main screen, I see lots of animation which I assume to be me moving my controls around, before the form clears itself up and looks like I wanted it to. I have anywhere from 100 to 300 text boxes, labels buttons and so-on that I arrange based on the system configuration. This is all done dynamically in code as the form loads because they can be vertical, horizontal, different quantities and so-on based on what type of hardware it is connected to. I tried making the form not visible in the load event but no luck, any other suggestions? It was very clean in VB6 No-e
-
I am in the process of converting a project from vb6 to vb.net. Code is now re-written and I can run it. The first thing I see is that when I select and option to load a form from my main screen, I see lots of animation which I assume to be me moving my controls around, before the form clears itself up and looks like I wanted it to. I have anywhere from 100 to 300 text boxes, labels buttons and so-on that I arrange based on the system configuration. This is all done dynamically in code as the form loads because they can be vertical, horizontal, different quantities and so-on based on what type of hardware it is connected to. I tried making the form not visible in the load event but no luck, any other suggestions? It was very clean in VB6 No-e
Frankly, I wouldn't be doing what you described. 300 controls on a form is excessive and takes forever to render. Rearranging them from their initial layout just makes things worse. I'd probably be skipping the textboxes all together unless these values can be updated. In either case, I'd look at compartmentalizing these in logical groups and creating controls or usercontrols that handle/rearrange/draw themselves depending on the data that's passed to them. You could then create instances of only those controls you need at runtime. Form.Load only happens the first time a form is displayed and happens just before it's shown. You'll get another event, VisibleChanged, when that happens. The earliest event you get from a form is HandleCreated.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak -
I am in the process of converting a project from vb6 to vb.net. Code is now re-written and I can run it. The first thing I see is that when I select and option to load a form from my main screen, I see lots of animation which I assume to be me moving my controls around, before the form clears itself up and looks like I wanted it to. I have anywhere from 100 to 300 text boxes, labels buttons and so-on that I arrange based on the system configuration. This is all done dynamically in code as the form loads because they can be vertical, horizontal, different quantities and so-on based on what type of hardware it is connected to. I tried making the form not visible in the load event but no luck, any other suggestions? It was very clean in VB6 No-e