473,394 Members | 1,828 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Hiding form on startup [c#]

Markus
6,050 Expert 4TB
Don't get angry! I have googled and I have come across answers - but mainly inconclusive answers.

I understand that taking the argument for new Form1() away (application.run()) is something I should do. But then the code in Form1 wouldn't be executed, would it? I don't quite understand how to go about doing this.
Oct 28 '08 #1
12 4694
Curtis Rutland
3,256 Expert 2GB
Well, you could just put
Expand|Select|Wrap|Line Numbers
  1. this.Visible = false;
  2.  
in the constructor of the startup form.

Just curious, why do you want to hide the form on startup?
Oct 28 '08 #2
Markus
6,050 Expert 4TB
Well, you could just put
Expand|Select|Wrap|Line Numbers
  1. this.Visible = false;
  2.  
in the constructor of the startup form.

Just curious, why do you want to hide the form on startup?
Because the form is pointless as it has no content. I am creating an app that allows me to access IP addresses I have and save them to the clipboard (makes things easier for me, I won't go into detail why).

Is there a better way to do this?
Oct 28 '08 #3
Curtis Rutland
3,256 Expert 2GB
Console app, maybe? Depends on what the exact functionality is. Is it something you just run once, and it finishes?
Oct 28 '08 #4
joedeene
583 512MB
Because the form is pointless as it has no content. I am creating an app that allows me to access IP addresses I have and save them to the clipboard (makes things easier for me, I won't go into detail why).

Is there a better way to do this?
A better way to hide the form? Not really, you can have it automatically minimized and still visible when clicked on.

joedeene
Oct 28 '08 #5
Markus
6,050 Expert 4TB
A better way to hide the form? Not really, you can have it automatically minimized and still visible when clicked on.

joedeene
I meant a better way than using forms.
Oct 28 '08 #6
Markus
6,050 Expert 4TB
Console app, maybe? Depends on what the exact functionality is. Is it something you just run once, and it finishes?
Well, in the future I'm going to add functionality to it like adding IP's, etc. So I'll just leave it as is.
Oct 28 '08 #7
tlhintoq
3,525 Expert 2GB
Because the form is pointless as it has no content. I am creating an app that allows me to access IP addresses I have and save them to the clipboard (makes things easier for me, I won't go into detail why).

Is there a better way to do this?
If you're going to make it completely invisible a notify tray icon might be handy. That way it doesn't have to appear in the start bar at all.

Give it method for double-click that goes something like

Expand|Select|Wrap|Line Numbers
  1.                 this.Visible = !this.Visible;
  2.  
to act like a show/hide toggle.
Oct 29 '08 #8
Markus
6,050 Expert 4TB
If you're going to make it completely invisible a notify tray icon might be handy. That way it doesn't have to appear in the start bar at all.

Give it method for double-click that goes something like

Expand|Select|Wrap|Line Numbers
  1.                 this.Visible = !this.Visible;
  2.  
to act like a show/hide toggle.
Aye, I had thought of that already.

Markus.
Oct 29 '08 #9
Plater
7,872 Expert 4TB
Its not very intuitive, but actually in the form.Shown() eventhandler is the best place to put the .Visible=false. For me this provides a split second blip, just so you know it happened. (I also use that NotifyIcon). Its fast enough that I never see the window, just a disturbance in pixels.

The Application.Run(new Form1()); call from what I have seen follow this:

Constructor
form_Load()
form_Shown()

I like to use that last one to make sure components have been initialized and whatnot
Oct 29 '08 #10
Curtis Rutland
3,256 Expert 2GB
I feel a great disturbance in the Pixels. As if millions of them suddenly cried out in terror, and were suddenly silenced.
Oct 29 '08 #11
I have found that if you create a Console App, there is no way to remove the command window from popping up during the running of the application.

Instead, choose a "Windows Application" but set the startup object to be "static main()" or "Sub Main", and not a form. Optionally remove the Form objects.
Oct 29 '08 #12
Just override the OnVisibleChanged method and change the visibility of the form there, like this:

Expand|Select|Wrap|Line Numbers
  1. protected override void OnVisibleChanged(EventArgs e)
  2. {
  3.     base.OnVisibleChanged(e);
  4.     this.Visible = false;
  5. }
And that's it! Simple and clean.
Dec 18 '11 #13

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: StressPuppy | last post by:
(posted this in VB group but then realized I probably should have posted here) I have a TabControl with several TabPages. Upon startup, I only want to show the first TabPage, hiding the rest....
6
by: PMBragg | last post by:
Thank you in advance for any and all assistance. Is there a way to hide the Main Access window with tables, queries, forms etc programmatically? Michael
0
by: Mark Reed | last post by:
Hi all, Access 2002 XP platform. I am trying to learn a little about programming (I know next to nothing so far) and have found some code which hides the toolbars. However, this bit of code is a...
1
by: Amber | last post by:
The DataGrid allows you to make columns visible or invisible on demand - even edit and other special columns. This article will show you how it is done. Some developers have reported problems...
8
by: Michael Rich | last post by:
I am writing a program that primaryly runs in the system tray. When the program starts, I would like to hide the main form and only show the tray icon. in the Form Load event I set Me.Visible =...
4
by: Tony Vitonis | last post by:
Hello. I've written an app that I want to "live" in the system tray. I want it to start up with just a tray icon showing, and if the user selects "Settings..." from the icon's context menu, to...
4
by: Johnnie Miami | last post by:
I'm using VB.Net 2005 beta 2 and have my login form (login.vb) specified as the startup form. If the user is successful logging in, I call my main form (main.vb). This all works fine but the...
5
by: Wilfried Mestdagh | last post by:
Hi, I have an application with a main form, but I want to hide it as fast as possible. Seems the only way to not show a single flicker is setting Opacity = 0 in the constructor, and Visible =...
5
by: BA | last post by:
Hi there I am trying to write an "application" in Access 2000, that displays a front end and allows the user to interact with the database without seeing Access loaded, in the background, nor on...
3
by: Anthony P. | last post by:
Hello Everyone, I'm writing an application that, so far, only has three forms: frmSplashScreen frmLicenseScreen frmConfigurationScreen Now, frmSplashScreen has a timer that sits it on...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.