Click here to Skip to main content
15,903,175 members
Home / Discussions / C#
   

C#

 
QuestionHow to set the TypeConverter of a Control? Pin
wangier16-Oct-03 22:33
wangier16-Oct-03 22:33 
AnswerRe: How to set the TypeConverter of a Control? Pin
god4k17-Oct-03 6:15
god4k17-Oct-03 6:15 
GeneralRe: How to set the TypeConverter of a Control? Pin
Bo Hunter17-Oct-03 11:14
Bo Hunter17-Oct-03 11:14 
GeneralRe: How to set the TypeConverter of a Control? Pin
wangier19-Oct-03 15:11
wangier19-Oct-03 15:11 
GeneralIts Vimal Need Clarification Pin
Vimal Tomar16-Oct-03 20:19
sussVimal Tomar16-Oct-03 20:19 
GeneralRe: Its Vimal Need Clarification Pin
leppie17-Oct-03 9:39
leppie17-Oct-03 9:39 
Generalneed some opinions. Pin
sharkfish16-Oct-03 17:46
sharkfish16-Oct-03 17:46 
Generalhelp I'm drowning in something obvious Pin
sharkfish16-Oct-03 16:11
sharkfish16-Oct-03 16:11 
but I can't see it!

I have a constructor
<br />
public nerd(int locNo)<br />
{<br />
   location = locNo<br />
}<br />

and a method/function that uses that constructor

<br />
public nerd myMethod(int locNo, divNo)<br />
{<br />
<br />
    nerd myNerd = new nerd(locNo);<br />
<br />
    //but here I want to change the value of nerd's location property<br />
<br />
    nerd.location = 9999;<br />
<br />
    return nerd;<br />
}<br />


But the returned nerd object from myMethod shows its location property still equal to the original locNo, not 9999.

So I tried passing in a nerd object using the ref keyword, and got the same result.

What is going on here? Yes, the constructor set the value of location, but then I change that value so I should now see the new value, not the old. If I do this using a ref like so:
<br />
//somewhere in the web page code behind I do this:<br />
<br />
nerd myNerd = new nerd(6666);<br />
<br />
<br />
public nerd myMethod(ref nerd refNerd, int locNo, int divNo)<br />
{<br />
<br />
nerd.location = locNo;<br />
<br />
}<br />
<br />
myMethod(ref nerd, 9999, 1);<br />
<br />


I still get the old location number, not 9999.

Am I crazy?
GeneralRe: help I'm drowning in something obvious Pin
Christian Graus16-Oct-03 16:50
protectorChristian Graus16-Oct-03 16:50 
GeneralRe: help I'm drowning in something obvious Pin
sharkfish16-Oct-03 17:37
sharkfish16-Oct-03 17:37 
GeneralRe: help I'm drowning in something obvious Pin
ThunorMagi16-Oct-03 18:18
sussThunorMagi16-Oct-03 18:18 
GeneralRe: help I'm drowning in something obvious Pin
Fang@Illusion21-Oct-03 9:27
Fang@Illusion21-Oct-03 9:27 
GeneralDetect cause of application memory leak Pin
Andy Davey16-Oct-03 13:46
Andy Davey16-Oct-03 13:46 
GeneralRe: Detect cause of application memory leak Pin
James Simpson17-Oct-03 1:40
James Simpson17-Oct-03 1:40 
GeneralRe: Detect cause of application memory leak Pin
Julian Bucknall [MSFT]17-Oct-03 5:08
Julian Bucknall [MSFT]17-Oct-03 5:08 
GeneralRe: Detect cause of application memory leak Pin
MtnBiknGuy17-Oct-03 6:50
MtnBiknGuy17-Oct-03 6:50 
GeneralRe: Detect cause of application memory leak Pin
Daniel Turini17-Oct-03 6:52
Daniel Turini17-Oct-03 6:52 
GeneralRe: Detect cause of application memory leak Pin
leppie17-Oct-03 9:46
leppie17-Oct-03 9:46 
GeneralRe: Detect cause of application memory leak Pin
Andy Davey17-Oct-03 11:08
Andy Davey17-Oct-03 11:08 
GeneralRe: Detect cause of application memory leak Pin
leppie17-Oct-03 11:49
leppie17-Oct-03 11:49 
GeneralRe: Detect cause of application memory leak Pin
Andy Davey17-Oct-03 12:00
Andy Davey17-Oct-03 12:00 
GeneralRe: Detect cause of application memory leak Pin
leppie17-Oct-03 12:16
leppie17-Oct-03 12:16 
GeneralUpdating my main form (gui) from another class Pin
eggie516-Oct-03 13:34
eggie516-Oct-03 13:34 
GeneralRe: Updating my main form (gui) from another class Pin
Andy Davey16-Oct-03 14:12
Andy Davey16-Oct-03 14:12 
GeneralRe: Updating my main form (gui) from another class Pin
eggie516-Oct-03 14:27
eggie516-Oct-03 14:27 

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.