S
sklett
I have a Form that I want to show a user to choose some options. I have set
it up so that Form's ctor takes ref parameters, one of them is an enum. For
example:
<code>
public enum AdjustTimeStyle
{
Undefined = 0,
Smooth
}
AdjustTimeStyle style = AdjustTimeStyle.Undefined;
AdjustTimeOptionsDlg dlg = new AdjustTimeOptionsDlg(ref style, /*other
params*/);
</code>
Now in the ctor I assign style to a member var
<code>
public class AdjustTimeOptionsDlg : Form
{
private AdjustTimeStyle m_style;
public AdjustTimeOptionsDlg(ref AdjustTimeStyle _style)
{
m_style = _style;
}
// other methods, etc
}
</code>
When the user chooses different options in the Form, I change the value of
m_style, when the control closes and I inspect the value of style (passed by
ref to the ctor of the dialog) it's still undefined. I don't get it. Is
this possible?
Thanks for reading,
Steve
it up so that Form's ctor takes ref parameters, one of them is an enum. For
example:
<code>
public enum AdjustTimeStyle
{
Undefined = 0,
Smooth
}
AdjustTimeStyle style = AdjustTimeStyle.Undefined;
AdjustTimeOptionsDlg dlg = new AdjustTimeOptionsDlg(ref style, /*other
params*/);
</code>
Now in the ctor I assign style to a member var
<code>
public class AdjustTimeOptionsDlg : Form
{
private AdjustTimeStyle m_style;
public AdjustTimeOptionsDlg(ref AdjustTimeStyle _style)
{
m_style = _style;
}
// other methods, etc
}
</code>
When the user chooses different options in the Form, I change the value of
m_style, when the control closes and I inspect the value of style (passed by
ref to the ctor of the dialog) it's still undefined. I don't get it. Is
this possible?
Thanks for reading,
Steve