• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 428
  • Last Modified:

how to avoid blinking of form for displaying before executing following programming?

how to avoid  blinking of form for displaying before executing following programming.
my aim is the form  should not  display when my project is running.
ok, but before  "me.visible=false"  the form was blinked just  half second for displaying
how to avoid that blinking for displaying?

Private Sub Form1_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Activated
        Me.Visible = False
End Sub
0
Tamilselvan
Asked:
Tamilselvan
4 Solutions
 
nordtorpCommented:
Try some of the tips in this thread:

[VB.NET] How to hide startup form?
http://forums.devshed.com/net-development-87/vb-net-how-to-hide-startup-form-80304.html
0
 
lenordisteCommented:
I usually do this and have no blinking (I converted this from C# with VS in hand, hopefully i did not mistyped something):

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Me.Hide()
            Me.ShowInTaskbar = false
            'your code
       End Sub

form load occurs before the activated and shown events. Using the combination of Hide (or visible=false if you wish) and ShownInTasbar=false seems to ensure your form won't "flicker". Also, doing this the activated event won't be raised.

0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
I've found that setting Opacity to 0 (zero) at design-time works best (also suggested in nordtorp's link)...

...but if you never want the form to display anyways then you can use a class that inherits from ApplicationContext() and pass that to Application.Run().  Disable the application framework in project properties and start with sub main.

Or you can put your code in the Application.Startup() event which fires before the form is displayed.  Then, at the end of that event just set "e.Cancel" to True and the app will exit without ever displaying the form designated as the "startup object".

What does your app do?
0
 
TamilselvanAuthor Commented:
mister idle mind , your answer is satisfy me . but i want answer in vb.net2003 windows applicatin \.
your answer is c#.net
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
No...my answer applies to VB.Net as well...but only in 2005 or above.

For 2003, you can just add a Module with a Public Sub Main and then in Project --> Properties change the "Startup Object".  Then you won't get a Form unless you explicitly show one with Application.Run().  If no Run() is called then the app simply exits when the last line of "Main" is executed.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now