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

Posted on 2010-01-03
Last Modified: 2013-11-25
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
Question by:Tamilselvan
    LVL 11

    Accepted Solution

    Try some of the tips in this thread:

    [VB.NET] How to hide startup form?
    LVL 11

    Assisted Solution

    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.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.

    LVL 85

    Assisted Solution

    by:Mike Tomlinson
    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?

    Author Comment

    mister idle mind , your answer is satisfy me . but i want answer in vb.net2003 windows applicatin \.
    your answer is
    LVL 85

    Assisted Solution

    by:Mike Tomlinson 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.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Training Course: Java/J2EE and SOA

    This course will cover both core and advanced Java concepts like Database connectivity, Threads, Exception Handling, Collections, JSP, Servlets, XMLHandling, and more. You'll also learn various Java frameworks like Hibernate and Spring.

    More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
    Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
    Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
    This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now