|
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
|
|
|
|
|
dirsow wrote: 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?
Compiles fine for me. What did the error say exactly? The message might be kinda helpful. FWIW, debug and release-mode follow the same rules, unless you have some preprocessor-directives in there. I don't see any in this code, so I'm curious about the description of the error you'd get.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
I forgot to put the error message:
Quote: Error 118 The name 'FrmRequestPwd' does not exist in the current context C:\DADOS\SuperControle\Projects\NewSuperControle\SuperControle\Softwares\Appls\SuperControle.Appls.SuperSPED\FrmSuperContabil.cs 95 21 SuperControle.Appls.SuperContabil
Thanks,
Dirso.
|
|
|
|
|
Ah, you'll need to add a reference indeed, particular to the project it is mentioning. You're using that form from another assembly, and the assembly it's contained in is not loaded on default.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
Hi!
Actually I already did it. I have the reference removed and added again to be sure, but still the same error. there are at least 100 forms in the reference and I use most of them in this new application and the error occurs only with 2 of them, but the weirdst part is in debug mode it works like a charm.
|
|
|
|
|
Do your "special forms" use a different namespace? What about
TheNamespace.FrmRequestPwd.Show(true, "Solicite uma senha ao seu representante!");
|
|
|
|