Click here to Skip to main content
16,004,977 members
Home / Discussions / C#
   

C#

 
GeneralRe: DirectX with Windows.Forms controls performance Pin
Andy Moore11-May-06 7:38
Andy Moore11-May-06 7:38 
GeneralRe: DirectX with Windows.Forms controls performance Pin
241411-May-06 8:12
241411-May-06 8:12 
GeneralRe: DirectX with Windows.Forms controls performance Pin
Andy Moore11-May-06 8:21
Andy Moore11-May-06 8:21 
QuestionBuild Windows application from command prompt Pin
KishoreT11-May-06 0:45
KishoreT11-May-06 0:45 
AnswerRe: Build Windows application from command prompt Pin
Stefan Troschuetz11-May-06 0:58
Stefan Troschuetz11-May-06 0:58 
GeneralRe: Build Windows application from command prompt Pin
KishoreT11-May-06 1:33
KishoreT11-May-06 1:33 
GeneralRe: Build Windows application from command prompt Pin
Stefan Troschuetz11-May-06 3:33
Stefan Troschuetz11-May-06 3:33 
QuestionProblem in Passing structure by reference in c# Pin
analytiks11-May-06 0:39
analytiks11-May-06 0:39 
struct Test
{
int iCount;
}


static void main ()
{
Test T1;
Add objAdd=new Add(ref T1);
MessageBox.Show(Convert.ToString(T1.iCount));
}


class Add : Form
{
Test t;

public Add(ref t1)
{
t=t1;
}

public btnNext_Click(object sender,EventArgs e)
{
t.iCount++
}
}

In the main function, a structure of type Test is created . I am passing this as a ref to a Form class Add.
The form class has a button, a click on which will increment the iCount of the structure by 1.
When the form closes, control returns to main() , where the iCount is to be displayed.

The problem is this, in Class Add I need to store the reference of the structure for future use. But this is not happening, in the constructor of Add, the reference t1 is being assigned to t. But, the declaration of t in the class initializes a new instance of the structure and therefore any changes to the structure is not getting reflected in the structure T1, when control return to main().

What can be done here? I cannot change the design of the application.

Help would be deeply appreciated.









-- modified at 6:39 Thursday 11th May, 2006
AnswerRe: Problem in Passing structure by reference in c# Pin
S. Senthil Kumar11-May-06 5:11
S. Senthil Kumar11-May-06 5:11 
QuestionUse c# dll in vb.6 Pin
Cliffer11-May-06 0:27
Cliffer11-May-06 0:27 
AnswerRe: Use c# dll in vb.6 Pin
Dave Kreskowiak11-May-06 3:45
mveDave Kreskowiak11-May-06 3:45 
AnswerRe: MVC game design question Pin
Robert Rohde11-May-06 1:01
Robert Rohde11-May-06 1:01 
Questionstrange problem Pin
rah_sin10-May-06 23:14
professionalrah_sin10-May-06 23:14 
AnswerRe: strange problem Pin
alexey N10-May-06 23:43
alexey N10-May-06 23:43 
GeneralRe: strange problem Pin
rah_sin10-May-06 23:57
professionalrah_sin10-May-06 23:57 
GeneralRe: strange problem Pin
alexey N11-May-06 0:05
alexey N11-May-06 0:05 
AnswerRe: strange problem Pin
albCode11-May-06 0:05
albCode11-May-06 0:05 
QuestionNHibernate.AssertionFailure Pin
KrIstOfK10-May-06 23:03
KrIstOfK10-May-06 23:03 
QuestionPlaying video from stream Pin
shadow0110-May-06 22:38
shadow0110-May-06 22:38 
AnswerRe: Playing video from stream Pin
NaNg1524111-May-06 2:37
NaNg1524111-May-06 2:37 
AnswerRe: Playing video from stream Pin
shadow0111-May-06 3:06
shadow0111-May-06 3:06 
QuestionListBox ValueMember Pin
adityap10-May-06 21:21
adityap10-May-06 21:21 
AnswerRe: ListBox ValueMember Pin
rah_sin10-May-06 23:23
professionalrah_sin10-May-06 23:23 
QuestionRe: ListBox ValueMember Pin
adityap10-May-06 23:54
adityap10-May-06 23:54 
QuestionFile lock problem with Image.FromFile() Pin
Stefan Spenz10-May-06 21:18
Stefan Spenz10-May-06 21:18 

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.