zozotsdimaroc
Messages postés15Date d'inscriptionvendredi 21 mars 2008StatutMembreDernière intervention 6 novembre 2009
-
27 déc. 2008 à 01:01
The Meteorologist
Messages postés232Date d'inscriptionjeudi 18 janvier 2007StatutMembreDernière intervention 3 novembre 2011
-
27 déc. 2008 à 02:16
salut tout le monde
j'ai un projet vb.net a faire et j' ai 2 problemes :
1 ere : dans mon application le user doit choisi enter de 2 options
* demande le code au demarage
* ne pas demende le code au demarage
ce choix est enregister dans la base sous forme de "oui" ou "non"
et j ai une formulaier loginform au demarege
ALORS , comment ferme formulaier loginform apres avoir le test de oui au non dans la base ? DANS le cas de "* ne pas demende le code au demarage
2 eme probleme .... apres reselu ce 1
merci d'avence
zozotsdimaroc
Messages postés15Date d'inscriptionvendredi 21 mars 2008StatutMembreDernière intervention 6 novembre 2009 27 déc. 2008 à 01:59
d'abord merci
j 'ai déja utilse cette methode mais tout l'application est se ferme pas seul loginform .
'*********************************
Private Sub LoginForm1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
adap_SECURITY.Fill(myset, "SECURITY")
If demande_passworde() = False Then
GestionAuditeurs.Show()
me.hide()
End If
End Sub
''''''''''''''''''''''''''''''''''''''''''''''''''
Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click
If test_vide() = True Then
MsgBox("Il a des champ vide", MsgBoxStyle.Exclamation, "Mot de passe")
ElseIf test() = False Then
Label1.Text = "Ce login est incorrect "
Else
Try
' verefication de mot de pass ------------------------------
If myset.Tables("SECURITY").Rows.Count > 0 Then
For i As Integer = 0 To myset.Tables("SECURITY").Rows.Count - 1
If myset.Tables("SECURITY").Rows(i)(1) = PasswordTextBox.Text Then
GestionAuditeurs.Show()
Me.Hide()
Else
Label2.Text = "Le Passeword est incorrect "
End If
Next
End If
'-------------------------------------
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.MsgBoxHelp)
End Try
End If
End Sub
Private Sub Cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel.Click
Me.Close()
End Sub
Function demande_passworde() As Boolean
If myset.Tables("SECURITY").Rows.Count > 0 Then
For i As Integer = 0 To myset.Tables("SECURITY").Rows.Count - 1
If myset.Tables("SECURITY").Rows(i)(2) = "oui" Then
demande_passworde = True
ElseIf myset.Tables("SECURITY").Rows(i)(2) = "non" Then
demande_passworde = False
End If
Next
End If
End Function
Function test_vide() As Boolean
Dim t As Boolean = False
For Each c As Control In Me.Controls
If TypeOf (c) Is TextBox Then
If c.Text = Nothing Then
Me.UsernameTextBox.Focus()
t = True
End If
End If
Next
test_vide = t
End Function
Function test() As Boolean
Dim t As Boolean = False
For i As Integer = 0 To myset.Tables("SECURITY").Rows.Count - 1
If UsernameTextBox.Text = myset.Tables("SECURITY").Rows(i)(0) Then
t = True
End If
Next
test = t
End Function
End Class