PC Review


Reply
Thread Tools Rate Thread

Form Loading

 
 
mike
Guest
Posts: n/a
 
      9th Dec 2003
I am coming from VB6 and I want to be able to load forms (invoke form load)
without having form displayed to user. I used the Load (form) method in VB6
to accomplish this. Is there an equivilent to this in C# or is there a
different to accomplish this?

Thanks


 
Reply With Quote
 
 
 
 
Norman Yuan
Guest
Posts: n/a
 
      10th Dec 2003
There is no exact equivalent to VB's Load() method when regarding Form
loading, but in .NET using keyword "new" creates Form's instance in memory,
while in VB "new" is not strictly required (although it is bad practice
without "newing" a form).

Therefore,

Dim f As New Form1() (VB.NET) or Form1 f =new Form1() (C#)

effectively creates an instance of Form1 object. if you want to run some
initializing code when the form is created in memory but not displayed, you
could place form initializing logic in its constructor, instead of in
Form_Load event handler, because the Form_Load event does not fire until you
call Form1.Show()/ShowDialog().

"mike" <none> wrote in message
news:ebb%(E-Mail Removed)...
> I am coming from VB6 and I want to be able to load forms (invoke form

load)
> without having form displayed to user. I used the Load (form) method in

VB6
> to accomplish this. Is there an equivilent to this in C# or is there a
> different to accomplish this?
>
> Thanks
>
>



 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      10th Dec 2003
* "mike" <none> scripsit:
> I am coming from VB6 and I want to be able to load forms (invoke form load)
> without having form displayed to user. I used the Load (form) method in VB6
> to accomplish this. Is there an equivilent to this in C# or is there a
> different to accomplish this?


\\\
Dim f As New Form1()
///

Notice that this won't fully initialize the form.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
 
Reply With Quote
 
Tom
Guest
Posts: n/a
 
      10th Dec 2003
Thanks for the replies. What I am trying to do is when the user opens a
file it will load each form with the data without showing the forms and then
I show the first form. Right now I open each form by showing it and I have
all these forms flickering in and out. I am looking for a way around this
like the way you could in VB6 with the Load (form) methods.

Thanks again

"Herfried K. Wagner [MVP]" <hirf-spam-me-(E-Mail Removed)> wrote in message
news:br6oaa$28biv8$(E-Mail Removed)...
> * "mike" <none> scripsit:
> > I am coming from VB6 and I want to be able to load forms (invoke form

load)
> > without having form displayed to user. I used the Load (form) method in

VB6
> > to accomplish this. Is there an equivilent to this in C# or is there a
> > different to accomplish this?

>
> \\\
> Dim f As New Form1()
> ///
>
> Notice that this won't fully initialize the form.
>
> --
> Herfried K. Wagner [MVP]
> <http://www.mvps.org/dotnet>



 
Reply With Quote
 
Ying-Shen Yu[MSFT]
Guest
Posts: n/a
 
      11th Dec 2003
Hi Tom,

Could you let me know why the New method couldn't solve your problem?
If you need do a lot of things in OnLoad event , is it possible to move
them to the constructor?
I'd like to know more about your root problem, maybe we can find some other
way to work around it.
Thanks!

Best regards,

Ying-Shen Yu [MSFT]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
This mail should not be replied directly, "online" should be removed before
sending.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Code in MDI child form Activated event handler causes form to appear as partially visible when loading RJ Microsoft Dot NET Framework Forms 3 2nd Nov 2006 04:58 PM
Switchboard usage preventing my form loading data form my database =?Utf-8?B?RWFtb25u?= Microsoft Access Getting Started 4 7th Sep 2006 10:46 PM
Transfer data to form from Excel range upon loading of form. =?Utf-8?B?Um9iIENyYXdmb3Jk?= Microsoft Excel Programming 2 24th Oct 2005 04:59 PM
Loading Form Beofre Loading the MainForm =?Utf-8?B?R2lkaQ==?= Microsoft C# .NET 1 17th Oct 2005 04:45 PM
Clear Form data withour re-loading form jmawebco Microsoft Access Form Coding 2 28th Sep 2005 07:50 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:59 PM.