Click here to Skip to main content
15,907,233 members
Home / Discussions / C#
   

C#

 
GeneralRe: FOCUS Pin
Heath Stewart28-Oct-03 2:54
protectorHeath Stewart28-Oct-03 2:54 
GeneralRe: FOCUS Pin
oOomen28-Oct-03 2:58
oOomen28-Oct-03 2:58 
QuestionHow to display store procedure list in Ms Access? Pin
god4k26-Oct-03 14:17
god4k26-Oct-03 14:17 
AnswerRe: How to display store procedure list in Ms Access? Pin
Heath Stewart26-Oct-03 17:17
protectorHeath Stewart26-Oct-03 17:17 
GeneralRe: There is stored procedure in MS Access Pin
Edbert P27-Oct-03 12:08
Edbert P27-Oct-03 12:08 
QuestionI have two Button, How to alter them? Pin
god4k26-Oct-03 14:16
god4k26-Oct-03 14:16 
AnswerRe: I have two Button, How to alter them? Pin
Christian Graus26-Oct-03 15:08
protectorChristian Graus26-Oct-03 15:08 
AnswerRe: I have two Button, How to alter them? Pin
Heath Stewart26-Oct-03 17:25
protectorHeath Stewart26-Oct-03 17:25 
You need to understand reference types. While the intrinsics like int, long, byte, char, etc. are value types (they stored the value), other variables you declare (like Button b1 = new Button()) are reference types:
Button b1 = new Button();
Button b2 = new Button();
b1.Text = "Button 1";
b2.Text = "Button 2";
b2 = b1;
Console.WriteLine(b2.Text); // Prints "Button 1"
Both b1 and b2 reference the Button originally assigned to b1. If you set b1 to null, b2 still holds a reference to it. The GC (garbage collector) will clean-up the Button originally assigned to b2 because nothing references it anymore.

Don't forget the importance of reading the docs before jumping into it. It's important to understand the concepts - not just of programming, but programming with the .NET framework and object-oriented development (OOD/OOP).

If you're looking to change the strings, do what you did with the ints, but remember that strings are reference types like most other objects. Being immutable, though, changing the value in the string isn't possible so they store values in a similar fashion as value types, but they can still be referenced by many different variables:
string s1 = b1.Text;
b1.Text = b2.Text;
b2.Text = s1;


 

-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
Generallistviewitem Pin
jphuphilly26-Oct-03 13:28
jphuphilly26-Oct-03 13:28 
GeneralSMTP Pin
totig26-Oct-03 12:57
totig26-Oct-03 12:57 
GeneralRe: SMTP Pin
Heath Stewart26-Oct-03 17:13
protectorHeath Stewart26-Oct-03 17:13 
GeneralRe: SMTP Pin
totig27-Oct-03 0:59
totig27-Oct-03 0:59 
GeneralRe: SMTP Pin
Heath Stewart27-Oct-03 2:09
protectorHeath Stewart27-Oct-03 2:09 
GeneralC# 2.0 Specs and Thoughts on Generics Pin
Heath Stewart26-Oct-03 12:28
protectorHeath Stewart26-Oct-03 12:28 
GeneralRe: C# 2.0 Specs and Thoughts on Generics Pin
jparsons26-Oct-03 14:46
jparsons26-Oct-03 14:46 
GeneralRe: C# 2.0 Specs and Thoughts on Generics Pin
Heath Stewart26-Oct-03 17:26
protectorHeath Stewart26-Oct-03 17:26 
GeneralRe: C# 2.0 Specs and Thoughts on Generics Pin
jparsons28-Oct-03 6:34
jparsons28-Oct-03 6:34 
GeneralRe: C# 2.0 Specs and Thoughts on Generics Pin
jparsons28-Oct-03 6:36
jparsons28-Oct-03 6:36 
GeneralRe: C# 2.0 Specs and Thoughts on Generics Pin
Kevin McFarlane27-Oct-03 5:34
Kevin McFarlane27-Oct-03 5:34 
Generalalot of questions Pin
bora3ee26-Oct-03 12:20
bora3ee26-Oct-03 12:20 
GeneralRe: alot of questions Pin
Heath Stewart26-Oct-03 17:39
protectorHeath Stewart26-Oct-03 17:39 
GeneralSystem.Web.Mail -> missing Pin
totig26-Oct-03 11:13
totig26-Oct-03 11:13 
GeneralRe: System.Web.Mail -> missing Pin
Heath Stewart26-Oct-03 12:11
protectorHeath Stewart26-Oct-03 12:11 
GeneralC# Class Library and VS.NET standard Pin
ewan26-Oct-03 8:18
ewan26-Oct-03 8:18 
GeneralRe: C# Class Library and VS.NET standard Pin
Blake Coverett26-Oct-03 8:28
Blake Coverett26-Oct-03 8:28 

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.