Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 1st, 2006, 10:53 PM
Registered User
 
Join Date: Nov 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default how to show/hide forms ?

i am trying to access StudentArea.cs form and hiding the current one Index.cs. Beside the Button in index.cs i have written the following code:

this.Close();
StudentArea.Show();

i am getting the following error:

C:\Documents and Settings\Administrator\My Documents\Visual Studio Projects\online_exam_csharp\index.cs(118): An object reference is required for the nonstatic field, method, or property 'System.Windows.Forms.Control.Show()'

Any Idea!


 
Old November 2nd, 2006, 10:44 AM
Authorized User
 
Join Date: Feb 2006
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to MAKO
Default

you must initialize a new object with the studentarea form in the way:

StudentArea frm = new StudentArea();
frm.Show();



MAKO - "El super simio"
 
Old November 2nd, 2006, 11:55 AM
Authorized User
 
Join Date: Jul 2006
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to abeen
Default


    the nonstatic field must be initialize a new object before used .
You referenced the nonstatic field,you must initialize a new object before used the nonstatic field .
  So the code is:
    StudentArea frm = new StudentArea();
    frm.Show();

 ABeen
  Life is not fair,get used to it .
 
Old November 3rd, 2006, 11:07 AM
Registered User
 
Join Date: Nov 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanxs for all your reply. I have done it






Similar Threads
Thread Thread Starter Forum Replies Last Post
HIDE/SHOW pallone Javascript How-To 11 April 16th, 2007 10:24 AM
How to hide control and show no space? rsearing ASP.NET 2.0 Basics 3 March 18th, 2007 09:39 AM
show/hide row(s) eugz Beginning PHP 0 March 19th, 2006 10:10 PM
How Do I SHOW and HIDE Windows Forms in VB.NET? kegeorge0819 VB How-To 1 March 10th, 2005 03:49 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.