473,466 Members | 1,376 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

FORM VISIBLE QUESTION

How can i make my form invisible
public class Form1 : System.Windows.Forms.Form

static void Main()

{

Application.Run(new Form1());
Form1.Visible=false;
}

It returns

An object reference is required for the nonstatic field, method, or property
'System.Windows.Forms.Control.Visible'

I have
using System.Windows.Forms;

too

How can i make invisible my form ?

Nov 3 '06 #1
5 7483
Various things here...
Form1 is the class not the instance... you need to make the *instance*
invisible.
Application.Run() won't return until the form has finished.

So; what exactly do you want to do... have a permenant invisible form? or
juts hide (close) the form e.g. on a button click? or what?

Marc
Nov 3 '06 #2
I want that When
my application starts i need to have invisible form
Nov 3 '06 #3
>I want that When
my application starts i need to have invisible form



//class InvisibleForm
class InvisibleForm:System.Windows.Forms.Form
{

//constructor
InvisibleForm()
{
WindowState=System.Windows.Forms.FormWindowState.M inimized;
}

//Main
[System.STAThread]
static void Main()
{
System.Windows.Forms.Application.Run(new InvisibleForm());
}
}


Nov 3 '06 #4
I dont want to have minimized Form ..

I want to have a form which not visible any part of the screen.

It is easy in Vb. I want to have a command like Form1.visible=false in VB ?
Nov 4 '06 #5
<in da clubwrote in message news:O3**************@TK2MSFTNGP04.phx.gbl...
>I dont want to have minimized Form ..

I want to have a form which not visible any part of the screen.

It is easy in Vb. I want to have a command like Form1.visible=false in VB
?
Marc already explained the problem with the code you posted to you.

The code you posted doesn't modify the form instance...it incorrectly
attempts to modify the class itself. You need to modify the form instance
if you want to change the Visible property of your form.

To do this, obviously you need two things:

* The reference to the instance
* Time to execute the code

As has been pointed out, the Run method won't return until the form has been
closed, so setting Visible in code after calling the Run method won't work
(even if you were setting the property on the instance, rather than using
the incorrect syntax you've got now). To manage the second item above, you
need to put the code to set the Visible property somewhere that will be run
before the form would actually be used. For example, the handler for the
Load event of the form.

If you put the code to set the Visible property in the handler for the Load
event, then getting the reference is easy. The handler would be a method
inside the form's class itself, and thus the Visible property is immediately
available to you, resolving the first item above:

void Form1_Load(object obj, EventArgs e)
{
Visible = false;
}

Pete
Nov 4 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: genetic.error | last post by:
I'm moving from Vb6 to VB.Net. I have a feeling this has come up before... The VS.Net MSDN file seems to state that the following should work: Form1.Show Form1.Visible = True Form1.Hide...
6
by: Randy Harris | last post by:
Anyone know if there is an Event that occurs when you open a form AFTER it is visible on the screen? I've tried Open, Activate, Load, Current, Got Focus. None of them do. ???
1
by: Tom | last post by:
In the Developers Handbook, Getz provides a way to create a survey report that displays either a line, Yes/No or multiple choice for each question. It's done by placing three controls (one for each...
10
by: Cy | last post by:
I've had good luck with posting in the past, so we'll see how things go this time...:) I have an Access 2000 form. On the form is about 40 objects. I want to set everything to invisible,...
4
by: Miguel Dias Moura | last post by:
Hello, i created an ASP.net / VB page with a really big form. Now i want to create 4 pages and in each one i will place 1/4 of the big form. The last page will send all the form values by...
1
by: dBNovice | last post by:
Please help! I have 3 forms: Task, Subtask, Elements. Elements is a subform of Subtask and Subtask is a subform of Task. I am able to navigate from Task to Subform to Element and from Element to...
1
by: tony | last post by:
Hello!! I have an application that consist of several windows forms. Lets call these A,B and C for simplicity. I have one main meny where the user can choose window form A or B or C. When a...
9
by: sck10 | last post by:
Hello, I am building a web form that will be used to gather information for marketing plans. The form will have 15 questions which must be answered. Each question can have large blocks of text....
1
by: feeman | last post by:
I have a form in access 2000 with a combo box containing names, this is linked to a sub form by the name index. on the sub form is a button that when pressed automatically enters the date into the...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.