المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : .exe Reference Problem - maybe



C# Programming
10-04-2012, 10:31 PM
Hi,
I made a software with several forms and a few of them have a private constructor and a public static method that is responsible for creating, initializing and showing it. Everything works fine within this application, but now I made another desktop application and I added a reference in this new application to the old one, so I could reuse all forms. Well, every form I call the constructor directly works fine (mdi forms for example), but those "special" classes with private constructors give me an error compiling in release mode, but weirdly it compiles fine in debug mode... Any ideas?

that's how i call
FrmRequestPwd.Show(true, "Solicite uma senha ao seu representante!");
public partial class FrmRequestPwd : Form { private FrmRequestPwd() { InitializeComponent(); } public static void Show(bool isError, string msg) { using (FrmRequestPwd frm = new FrmRequestPwd()) { frm.lblMsg.Text = msg; frm.Text = isError ? "Erro" : "Aviso"; frm.txtSerialHD.Text = Kernel32Managed.GetVolumeSerial('C'); frm.ShowDialog(); } } private void btnOK_Click(object sender, EventArgs e) { Close(); } }Thanks!
Dirso