Click here to Skip to main content
16,005,178 members
Home / Discussions / C#
   

C#

 
GeneralRe: An inherited control on a form that will be inherited Pin
Jochen Jonckheere8-Dec-04 19:55
Jochen Jonckheere8-Dec-04 19:55 
GeneralRe: An inherited control on a form that will be inherited Pin
Alex Korchemniy8-Dec-04 20:48
Alex Korchemniy8-Dec-04 20:48 
GeneralWMI Pin
john kuruvila8-Dec-04 8:28
john kuruvila8-Dec-04 8:28 
GeneralRe: WMI Pin
Alex Korchemniy8-Dec-04 9:44
Alex Korchemniy8-Dec-04 9:44 
QuestionParsing Source in C#/NET? Pin
McClamm8-Dec-04 8:21
McClamm8-Dec-04 8:21 
AnswerRe: Parsing Source in C#/NET? Pin
Javier Lozano8-Dec-04 10:10
Javier Lozano8-Dec-04 10:10 
AnswerRe: Parsing Source in C#/NET? Pin
Daniel Turini8-Dec-04 16:46
Daniel Turini8-Dec-04 16:46 
GeneralGlobal variable Pin
hauki26018-Dec-04 8:17
susshauki26018-Dec-04 8:17 
I am abeginner in C# and I try to access a variable defined in the main class (frmMain) witch is declared like in the following code:
<br />
using System;<br />
using System.Drawing;<br />
using System.Collections;<br />
using System.ComponentModel;<br />
using System.Windows.Forms;<br />
using System.Data;<br />
<br />
namespace Test<br />
{<br />
	/// <summary><br />
	/// Zusammenfassung für Form1.<br />
	/// </summary><br />
<br />
	public class frmMain : System.Windows.Forms.Form<br />
	{<br />
	  <big>public string	testString;</big><br />
<br />
		public frmMain()<br />
		{<br />
			<br />
			//<br />
			InitializeComponent();<br />
<br />
		}<br />
<br />
		[STAThread]<br />
		static void Main() <br />
		{<br />
			Application.Run(new frmMain());<br />
		}<br />
<br />
		private void mnuMenu_Click(object sender, System.EventArgs e)<br />
		{<br />
			frmChild newMDIChild = new frmChild();<br />
			// Set the Parent Form of the Child window.<br />
			newMDIChild.MdiParent = this;<br />
			// Display the new form.<br />
			newMDIChild.Show();<br />
		}<br />
	}<br />
}


Now i try to access the variable testString in the child window frmChild:
<br />
testString= "Why does this not work???";


Even frmMain.testString= "Why does this not work???";
and won't work.

Can somebody help a stupid beginner? I know it must be easy.
Confused | :confused: Confused | :confused: Confused | :confused: Confused | :confused:



Thanks
The german stupid
GeneralRe: Global variable Pin
Gary Thom8-Dec-04 8:34
Gary Thom8-Dec-04 8:34 
GeneralRe: Global variable Pin
hauki26018-Dec-04 9:10
susshauki26018-Dec-04 9:10 
QuestionAnonymous Secure FTP site anyone? Pin
schuck8-Dec-04 6:57
schuck8-Dec-04 6:57 
AnswerRe: Anonymous Secure FTP site anyone? Pin
Daniel Turini8-Dec-04 8:07
Daniel Turini8-Dec-04 8:07 
GeneralSqlMoney math function Pin
webhay8-Dec-04 6:42
webhay8-Dec-04 6:42 
QuestionCompareNoCase? Pin
bouli8-Dec-04 6:31
bouli8-Dec-04 6:31 
AnswerRe: CompareNoCase? Pin
Daniel Turini8-Dec-04 8:00
Daniel Turini8-Dec-04 8:00 
GeneralCall is rejected by callee exception Pin
Asuri8-Dec-04 5:38
Asuri8-Dec-04 5:38 
GeneralTcp Client /server synchronous read Pin
jayanth sai8-Dec-04 4:51
jayanth sai8-Dec-04 4:51 
GeneralRuntime Error 406 Pin
sharon_s8-Dec-04 4:25
sharon_s8-Dec-04 4:25 
Generaloverloading == and != Pin
Jan R Hansen8-Dec-04 4:08
Jan R Hansen8-Dec-04 4:08 
GeneralRe: overloading == and != Pin
Daniel Turini8-Dec-04 5:21
Daniel Turini8-Dec-04 5:21 
GeneralRe: overloading == and != Pin
Jan R Hansen8-Dec-04 11:41
Jan R Hansen8-Dec-04 11:41 
GeneralRe: overloading == and != Pin
Skynyrd8-Dec-04 23:51
Skynyrd8-Dec-04 23:51 
GeneralDataGrid formatting Pin
wtdoor19658-Dec-04 3:27
wtdoor19658-Dec-04 3:27 
GeneralBitmap Rendering speed Pin
Tristan Rhodes8-Dec-04 3:17
Tristan Rhodes8-Dec-04 3:17 
GeneralRe: Bitmap Rendering speed Pin
Daniel Turini8-Dec-04 5:32
Daniel Turini8-Dec-04 5:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.