Candidate-7-Pro/FrmEdit.vb
2021-09-10 01:19:48 +02:00

72 lines
3.2 KiB
VB.net

Public Class FrmEdit
Private Sub FrmEdit1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
RBId.Checked = True REM "Check par défaut" au chargement.
'Selectedclef = FrmAccueil.IDlu
Call LectBdD() REM Contruit la liste des candidats NON supprimés a partir du tableau d'index.
End Sub
REM Fonctionne comme ca par defaut.
'Private Sub RBId_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles RBId.CheckedChanged, RBNP.CheckedChanged
' If RBId.Checked Then
' RBNP.Checked = False
' End If
' If RBNP.Checked Then
' RBId.Checked = False
' End If
'End Sub
Private Sub CBNP_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles CBNP.GotFocus
RBNP.Checked = True REM Permet de "checker" le ratiobox correspondant au focus (On veut choisir son nom dans une GRrB).
End Sub
Private Sub TxtId_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles TxtId.GotFocus
RBId.Checked = True REM Permet de "checker" le ratiobox correspondant au focus (On veut enter l'ID du candidat).
End Sub
Private Sub CmdNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdNext.Click
Dim court As Integer
If RBId.Checked Then REM Via la textbox
If TxtId.Text = "" Then Exit Sub
Selectedclef = TxtId.Text
If Selectedclef >= ClefMAX Or Selectedclef < 1 Then
MsgBox("L'identifiant que vous avez saisie n'est pas valide.", MsgBoxStyle.Exclamation, "Candidat introuvable")
Exit Sub
Else
If Tindex(Selectedclef).Suppr Then
MsgBox("Ce candidat a été supprimé, il ne peut pas être modifié.", MsgBoxStyle.Exclamation, "Candidat indisponible")
Exit Sub
End If
End If
ElseIf CBNP.SelectedIndex <> -1 Then REM Via le CBox
If IsNumeric(Microsoft.VisualBasic.Left(CBNP.SelectedItem, 2)) Then
court = Microsoft.VisualBasic.Left(CBNP.SelectedItem, 2)
End If
Selectedclef = court
End If
FileGet(nf, cddts, Selectedclef)
Me.Hide() REM On utilise hide pour naviger entre les feuilles sans devoir modifier la BdD, le bouton "MaJ" a la dernière feuille (Input3) enregistrera tout les modifications.
FrmInput1.Show()
End Sub
Private Sub CmdAnnul_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdAnnul.Click
Me.Close() REM On close pour réinitialiser. Peut-être on programmera une fonction pour reset plus vite, mais on remplacera par des hides. Plus dangereux a programmer.
FrmAccueil.Show()
End Sub
Private Sub TxtId_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TxtId.KeyPress
If e.KeyChar = vbBack Then
Exit Sub
End If
If e.KeyChar < "0" Or e.KeyChar > "9" Then REM On peut utiliser aussi Not IsNumeric(<Objet>)
e.KeyChar = Chr(0)
End If
End Sub
End Class