|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Getting form to run its load event without showing formHi All
I need help on how to load a form in the background so the load event runs (only once) then I can pass data and call showdialog I have code in the forms load event which populates comboboxes etc I then want to select a particular combobox index and call routines within the form before showing it dialog I currently call form.show then form.hide, pass the data as required then call form.showdialog I notice the form load event fires on both form.show and form.showdialog Regards Steve Hi Steve,
Thank you for your post. I think you can just put your initialization code in the constructor of your form, just make sure the InitializeComponent() is called first: Public Sub New() ' This call is required by the Windows Form Designer. InitializeComponent() ' Add any initialization after the InitializeComponent() call. End Sub Then you don't need to call Show(), Hide() again; just new the form object, pass some data, and call ShowDialog(). Hope this helps. Please feel free to post here if anything is unclear. Regards, Walter Wang (waw***@online.microsoft.com, remove 'online.') Microsoft Online Community Support ================================================== When responding to posts, please "Reply to Group" via your newsreader so that others may learn and benefit from your issue. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights. Hello Walter Wang [MSFT],
> Then you don't need to call Show(), Hide() again; just new the form Just new the form!!? Geez.. No wonder VB programmers get a bad rap.. and > object, pass some data, and call ShowDialog(). yer a Microsoft employee!! Geezus! It's called instantiation for those of you speaking ghetto-talk. You instantiate an object. -Boo Walter's solution makes more sense.
The code that needs to be executed when the form is created needs to go in the constructor, not the form_load.
Multithread Revisted
Removing the " Web Form Designer Generated Code " region after converting from ASP.NET 1.1 to ASP.NE Need help on windows service and timer CheckedListbox backcolor question File.Exists not working. Confused About Dispose and Finalize in VS.Net Convert Color image to Gray Shade Image how to convert htm file to word or excel file with images as in htm How to use DataGridComboColumnStyle How to access cross-site DOM tree |
|||||||||||||||||||||||