Click here to Skip to main content
15,887,676 members
Home / Discussions / C#
   

C#

 
GeneralRe: delegate ordering Pin
leppie10-Jan-03 6:07
leppie10-Jan-03 6:07 
GeneralExport to Excel Problem Pin
Jassim Rahma10-Jan-03 0:10
Jassim Rahma10-Jan-03 0:10 
GeneralCommandbars Pin
suresh_sathya9-Jan-03 20:18
suresh_sathya9-Jan-03 20:18 
QuestionInclude Dll's in Build? Pin
granthnk9-Jan-03 16:54
granthnk9-Jan-03 16:54 
AnswerRe: Include Dll's in Build? Pin
Stephane Rodriguez.9-Jan-03 21:09
Stephane Rodriguez.9-Jan-03 21:09 
QuestionHow to get control reference from handle? Pin
FruitBatInShades9-Jan-03 14:01
FruitBatInShades9-Jan-03 14:01 
AnswerRe: How to get control reference from handle? Pin
leppie9-Jan-03 20:51
leppie9-Jan-03 20:51 
GeneralStatic TextBoxt that keeps disappearing Pin
laphijia9-Jan-03 13:43
laphijia9-Jan-03 13:43 
Hi folks,

I'm just beginning with C#. I am doing an RPN calculator and it seems to work pretty well.

However I have a problem. I have a class that manages the stack, and a class that manages the displaying of numbers on the display, that actually is a TextBox, tbDisplay.
Since the TextBox in on the main form, the one that gets created automatically when you use the form designer, I have to access it from the display class. How do I do it?

What I did is declaring the TextBox public static. After from the display class I access it using Form1.tbDisplay. It works!

The problem is that everytime I add a control, or do "something", something being I don't know exactly what, the TextBox disappears. It seems that VisualStudio removes the lines of code. What VS does is not removing the declarations of the control, public static etc..., but it removes the lines in the initialization. It removes the line from the this.Controls.AddRange.

It also removes these lines:

Calc.tbDisplay = new System.Windows.Forms.TextBox();

// tbDisplay
//
Calc.tbDisplay.Location = new System.Drawing.Point(136, 56);
Calc.tbDisplay.Name = "tbDisplay";
Calc.tbDisplay.Size = new System.Drawing.Size(208, 20);
Calc.tbDisplay.TabIndex = 18;
Calc.tbDisplay.Text = "0";
Calc.tbDisplay.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;

This happens all the times. It's the tenth time I add the lines back by hand, it's a mess.

What's the problem here? I suspect that my approach of declaring it static.. etc it's not the right solution? How should it work???

How do I, from inside Z class, control an istance of a X class that is declared into Y class?

Thanks for any help.
I hope to finish my calc so maybe I can post my first arcticle on CodeProject. It uses a nice stack class. And it behaves exactly like the calculator I am emulating, the HP 12C.Big Grin | :-D

Edward
GeneralRe: Static TextBoxt that keeps disappearing Pin
FruitBatInShades9-Jan-03 14:07
FruitBatInShades9-Jan-03 14:07 
GeneralRe: Static TextBoxt that keeps disappearing Pin
laphijia9-Jan-03 21:33
laphijia9-Jan-03 21:33 
Generalweird MSCORLIB Exception Pin
matthias s.9-Jan-03 11:36
matthias s.9-Jan-03 11:36 
GeneralRe: weird MSCORLIB Exception Pin
leppie9-Jan-03 12:13
leppie9-Jan-03 12:13 
GeneralRe: weird MSCORLIB Exception Pin
matthias s.10-Jan-03 6:33
matthias s.10-Jan-03 6:33 
GeneralRe: weird MSCORLIB Exception Pin
leppie10-Jan-03 6:55
leppie10-Jan-03 6:55 
GeneralRe: weird MSCORLIB Exception Pin
matthias s.10-Jan-03 7:32
matthias s.10-Jan-03 7:32 
GeneralRe: weird MSCORLIB Exception - Solution Pin
matthias s.10-Jan-03 7:47
matthias s.10-Jan-03 7:47 
GeneralRe: weird MSCORLIB Exception Pin
James T. Johnson10-Jan-03 18:31
James T. Johnson10-Jan-03 18:31 
GeneralRe: weird MSCORLIB Exception Pin
leppie11-Jan-03 0:23
leppie11-Jan-03 0:23 
Question'Subclassing' child controls. Is it possible? Pin
FruitBatInShades9-Jan-03 10:45
FruitBatInShades9-Jan-03 10:45 
AnswerRe: 'Subclassing' child controls. Is it possible? Pin
leppie9-Jan-03 11:00
leppie9-Jan-03 11:00 
GeneralRe: 'Subclassing' child controls. Is it possible? Pin
FruitBatInShades9-Jan-03 11:10
FruitBatInShades9-Jan-03 11:10 
GeneralRe: 'Subclassing' child controls. Is it possible? Pin
David Stone11-Jan-03 5:16
sitebuilderDavid Stone11-Jan-03 5:16 
GeneralQuestion on xml encoding in C# Pin
Bugoy9-Jan-03 10:29
Bugoy9-Jan-03 10:29 
GeneralRe: Question on xml encoding in C# Pin
leppie9-Jan-03 10:46
leppie9-Jan-03 10:46 
GeneralRe: Question on xml encoding in C# Pin
Bugoy9-Jan-03 11:49
Bugoy9-Jan-03 11:49 

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.