Error in the SF Login Form Template


Author
Message
Rogerio Mauri
Rogerio Mauri
StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)
Group: StrataFrame Users
Posts: 205, Visits: 629
After to add SF Login Form in the my project (C#), the constructor is not being invoked. I included the code below to decide the problem.

public LoginForm1()

{

InitializeComponent();

}



Rogério Mauri Smile

StrataFrame Team
S
StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
If you want to show a custom login form, you will need to set the form type within the ShowLoginAndInitMainForm() method in the Program.cs file like this:

private static void ShowLoginAndInitMainForm(ShowLoginAndInitFormEventArgs e)

{

//-- Set the login form to your custom login form (optional)

Login.LoginFormType = typeof(MyLoginForm);

//-- Show the login form and authenticate the user

e.ShowMainForm = Login.ShowLoginAndAuthUser(true);

}


Rogerio Mauri
Rogerio Mauri
StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)
Group: StrataFrame Users
Posts: 205, Visits: 629
Ben.. Tks for your reply, but the error continues, therefore I already had followed the recommendation with template of the application with the security module.

private static void ShowLoginAndInitMainForm(ShowLoginAndInitFormEventArgs e)

{

//-- Set the login form to your custom login form (optional)

Login.LoginFormType = typeof(FormLogin);

//-- Show the login form and authenticate the user

e.ShowMainForm = Login.ShowLoginAndAuthUser(true);

}

Rogério Mauri Smile



Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Hi Rogerio.

When you say the "error continues", do you mean you get an error message? If so, you could copy it and post here.

Rogerio Mauri
Rogerio Mauri
StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)
Group: StrataFrame Users
Posts: 205, Visits: 629
Ivan... Boa Noite...

Sim. O erro continua. O que notei é que o SF Login Form customizado não faz uma chamada explícita ao método de inicialização dos componentes do form (InitializeComponent()). Consequentemente quando as propriedades dos objetos são inicializadas (set) ocorre o erro NullReferenceException. O erro ocorre aqui:

bool ILoginForm.AllowAppExit

{

     get { return this.cmdExit.Visible; }

     set{ this.cmdExit.Visible = value; }

}

 Se no Form Login você incluir o método construtor da classe com a chamada ao InitializeComponent o erro não ocorre mais:

public partial class FormLogin : ILoginForm

{

        public FormLogin()

        {

            InitializeComponent();

         }

        ....

}

Obrigado pelo suporte em português. Deixo com você a tradução para nossos amigos dos EUA.

OBS: Estou com a versão de avaliação do SF (1.6.0), baixada do site.

Abraços...

Rogério Mauri (Licitec Software - Brazil)



Rogério Mauri Smile

Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Você chegou a seguir os passos do Help? Em "Adding Security to an Application" tem um passo-a-passo, inclusive mencionando o uso de criar seu "login form", tem um link em "create a login form" .

Só para você dar uma olhada, aqui vai o login form de uma aplicação minha.

Você pode reparar que é um login form customizado. Eu não criei nada em código para isto. Simplesmente criei um novo Login Form baseado no template que vem com o SF e traduzi algumas strings no código deste form.

Então, fui no AppMain.vb (no meu caso, no seu, Program.cs, como o Ben te falou) e fiz a mudança necessária no nome do form para login.

Se ainda não te ajudar aí, vai falando, que a gente faz funcionar juntos.

 

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Considering my Portuguese is a little rusty BigGrin, let me know if I can help Smile
Rogerio Mauri
Rogerio Mauri
StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)
Group: StrataFrame Users
Posts: 205, Visits: 629
Olá Ivan...

Sim... Segui o passo-a-passo.

O problema pode estar na sintaxe. Você está utilizando VB.NET e eu estou utilizando C#.

O erro pode estar acontecendo quando o templante gera para C# e para VB.NET.

Rogério Mauri Smile



Rogerio Mauri
Rogerio Mauri
StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)
Group: StrataFrame Users
Posts: 205, Visits: 629
Ivan... Uma correção no texto

"... e para VB.NET, não."

Trent...

We are in understanding. Ivan will be able later registering a summary of the dialogue.Smile

Rogério Mauri Smile



Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Hi Trent.

Rogerio is saying that he gets a NullReferenceException only when he uses the C# Login Form template, whereas if he does the same with the VB.NET version, it works fine. Would you have any guess?

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search