3 Forms
2 Botões
1 TextBox - Name: txtSerial
2 Labels
Começando a configurar:
Form1 - Text: Sistema - / 1 Botão - Text: Entrar no sistema
Form2 - Text: Registrar / 1 TextBox - Name: txtSerial / 1 Botão - Text: Ativar / 1 Label - Text: Insira a chave:
Form3 - Text: Principal / 1 Label - Text: Programa ativado com sucesso!
Depois faça o seguinte:
Vamos para o Form1:
Código do Load do Form1:
If My.Settings.Ativado = True Then
Me.Text = Me.Text & "Ativado"
Else
Me.Text = Me.Text & "Sistema não ativado..."
End If
Código do Botão: (Entrar no sistema) do Form1:
If My.Settings.Ativado = False Then
Form2.Show()
Else
Form3.Show()
End If
Agora o Form2:
Código do botão Ativar do Form2:
'Serial para testar é: 0000-0000-1111-1111 para mudar o serial basta alterar esta parte do código
Dim Serial As String = "0000-0000-1111-1111"
If txtSerial.Text = Serial Then
MsgBox("Sucesso! Sistema ativado...", MsgBoxStyle.Information, "Sucesso!")
My.Settings.Ativado = True
My.Settings.Save()
My.Settings.Reload()
Else
MsgBox("Erro! Serial inválido", MsgBoxStyle.Critical, "Erro!")
End If
Form3:
Nenhum comentário:
Postar um comentário