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

Posted on 2010-01-03
Medium Priority
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

nordtorp earned 500 total points
ID: 26165090
Try some of the tips in this thread:

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

Assisted Solution

lenordiste earned 500 total points
ID: 26165098
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 86

Assisted Solution

by:Mike Tomlinson
Mike Tomlinson earned 1000 total points
ID: 26165786
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

ID: 26180904
mister idle mind , your answer is satisfy me . but i want answer in vb.net2003 windows applicatin \.
your answer is c#.net
LVL 86

Assisted Solution

by:Mike Tomlinson
Mike Tomlinson earned 1000 total points
ID: 26181433
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.

Featured Post

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…
Suggested Courses
Course of the Month13 days, 22 hours left to enroll

807 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