Hi,
[C# / VS2003]
I've run into a weird problem with the form designer. I have three classes:
a messagebox class and two forms (Base and Derived which is derived from
Base):
(note: only relevant code below)
<code>
public class MyMsg
{
[DllImport("user 32.dll", EntryPoint="Mes sageBoxW",
CharSet=CharSet .Unicode, ExactSpelling=t rue,
CallingConventi on=CallingConve ntion.StdCall)]
private static extern IntPtr MessageBox(UInt 32 hWnd, string AText,
string ACaption, UInt32 AType);
public static void Show(string AText)
{
MessageBox(0, AText, "Caption", 0);
}
}
public class BaseForm : System.Windows. Forms.Form
{
public BaseForm()
{
InitializeCompo nent();
MyMsg.Show("Tes t");
}
}
public class DerivedForm : BaseForm
{
public DerivedForm()
{
InitializeCompo nent();
}
}
</code>
When I show DerivedForm in the designer my messagebox is shown. When I show
BaseForm in the designer, the messagebox is NOT shown. What gives?! Is this
a bug?
Are there any specifications of what and what isn't created/shown/whatever
designtime vs. runtime?
I know the above code doesn't really make sense, but its a simplification of
some similar code used for singleton patterns...
Regards,
Sebastian
[C# / VS2003]
I've run into a weird problem with the form designer. I have three classes:
a messagebox class and two forms (Base and Derived which is derived from
Base):
(note: only relevant code below)
<code>
public class MyMsg
{
[DllImport("user 32.dll", EntryPoint="Mes sageBoxW",
CharSet=CharSet .Unicode, ExactSpelling=t rue,
CallingConventi on=CallingConve ntion.StdCall)]
private static extern IntPtr MessageBox(UInt 32 hWnd, string AText,
string ACaption, UInt32 AType);
public static void Show(string AText)
{
MessageBox(0, AText, "Caption", 0);
}
}
public class BaseForm : System.Windows. Forms.Form
{
public BaseForm()
{
InitializeCompo nent();
MyMsg.Show("Tes t");
}
}
public class DerivedForm : BaseForm
{
public DerivedForm()
{
InitializeCompo nent();
}
}
</code>
When I show DerivedForm in the designer my messagebox is shown. When I show
BaseForm in the designer, the messagebox is NOT shown. What gives?! Is this
a bug?
Are there any specifications of what and what isn't created/shown/whatever
designtime vs. runtime?
I know the above code doesn't really make sense, but its a simplification of
some similar code used for singleton patterns...
Regards,
Sebastian
Comment