Module Module1 Structure PERS Dim Nom As String Dim Prenom As String Dim Adresse As String Dim CP As Integer Dim Ville As String Dim Age As Integer REM Stocke la date de naissance en mois (plus facile pour convertir après) Dim Region As Integer REM Stocke l'index Dim Ecrit() As Integer REM index Dim Oral() As Integer REM index Dim Fac As Integer REM Stocke l'index End Structure Structure Index 'Dim no As Integer Dim nom As String Dim prenom As String Dim Suppr As Boolean End Structure Public tme() As String = {"Lancer", "Natation", "Saut", "Allemand", "Anglais", "Astronomie", "Espagnol", "Histoire", "Russe", "Biologie", "Français", "Géographie", "Géologie", "Mathématique", "Philosophie"} Public nais As Integer REM en mois. ANS*12 + MOIS Public cddts As PERS REM sert de "Tampon" entre les données entrées dans les feuilles et le fichier. Public Tindex() As Index REM Sert pour le bilan des supprimés, et pour générer la liste des candidats valides (sans consulter le fichier). Public Boule As Boolean REM inscription ou édition Public Horaire As String REM Sert a stoquer l'heure pour les autres fenetres QUI ONT DES TIMERS. Public nf As Integer REM Numéro de flux. Public lgcddts As Integer REM Sert a obtenir la bonne longueur. Public ClefMAX As Integer = 1 REM Dernier/Nombre de candidats dans le Fichier. Public PosMAX As Integer = 0 REM Dernier/Nombre de candidats dans le tableau de structure. REM Pour s'y retrouver entre ClefMAX et PosMAX : REM ClefMAX indique le nombre de clefs dans le fichier. REM PosMAX indique le nombre de poste dans le tableau d'index. REM La relation entre ces deux variables sont PosMAX = ClefMAX - 2. Le premier candidat stocké dans le fichier (clef = 2), il a la position 0 dans le fichier. Public IndexFac As Integer REM Retient l'index de l'examen (du tableau) pour l'examen facultatif. L'ancien index retenait la position dans la CboBox, et ne correspondait pas toujours a celui du tableau. Public Selectedclef As Integer REM Pour la feuille FrmEdit : elle contient le n° d'inscription choisit donné par l'utilisateur Public Sub InscBdD() If PosMAX - 1 >= UBound(Tindex) Then ReDim Preserve Tindex(PosMAX + 2) End If REM Entrée depuis la feuille 1 cddts.Nom = FrmInput1.TxtNom.Text cddts.Prenom = FrmInput1.TxtPrenom.Text cddts.Adresse = FrmInput1.TxtAdrss.Text cddts.CP = FrmInput1.TxtCP.Text cddts.Ville = FrmInput1.TxtVille.Text cddts.Age = nais 'Tindex(ClefMAX - 2).no = ClefMAX Tindex(PosMAX).nom = cddts.Nom Tindex(PosMAX).prenom = cddts.Prenom REM Entrée depuis la feuille 2 cddts.Region = FrmInput2.CboRegion.SelectedIndex Dim b As CheckBox Dim j As Integer = 0 Dim i As Integer = 0 For Each b In FrmInput2.GBEcrit.Controls If b.Checked Then cddts.Ecrit(j) = i + 3 j += 1 End If If j >= 4 Then Exit For i += 1 Next j = 0 i = 0 For Each b In FrmInput2.GBOral.Controls If b.Checked Then cddts.Oral(j) = i If j >= 3 Then Exit For j += 1 End If i += 1 Next If FrmInput2.RBYes.Checked Then cddts.Fac = IndexFac REM Entrée depuis la feuille 3 Tindex(PosMAX).Suppr = False REM Sauvegarde FilePut(nf, cddts, ClefMAX) FilePut(nf, cddts.CP = ClefMAX, 1) ClefMAX += 1 PosMAX += 1 End Sub Public Sub MaJBdD() REM EST-IL NECESSAIRE DE FAIRE DES TESTS POUR VOIR DES MODIFICATIONS UTILISATEURS, OU MODIFIER TOUT DE MÊME ? REM OUI. REM Entrée depuis la feuille 1 cddts.Nom = FrmInput1.TxtNom.Text cddts.Prenom = FrmInput1.TxtPrenom.Text cddts.Adresse = FrmInput1.TxtAdrss.Text cddts.CP = FrmInput1.TxtCP.Text cddts.Ville = FrmInput1.TxtVille.Text cddts.Age = nais REM Entrée depuis la feuille 2 cddts.Region = FrmInput2.CboRegion.SelectedIndex Dim b As CheckBox Dim j As Integer = 0 Dim i As Integer = 0 For Each b In FrmInput2.GBEcrit.Controls If b.Checked Then cddts.Ecrit(j) = i + 3 j += 1 End If If j >= 4 Then Exit For i += 1 Next j = 0 i = 0 For Each b In FrmInput2.GBOral.Controls If b.Checked Then cddts.Oral(j) = i If j >= 3 Then Exit For j += 1 End If i += 1 Next If FrmInput2.RBYes.Checked Then cddts.Fac = IndexFac End If REM Sauvegarde FilePut(nf, cddts, Selectedclef) End Sub Public Sub SupprBdD() Dim i As Integer = 0 REM Entrée depuis la feuille 1 cddts.Nom = "" cddts.Prenom = "" cddts.Adresse = "" cddts.CP = 0 cddts.Ville = "" cddts.Age = 0 REM Entrée depuis la feuille 2 For i = 0 To UBound(cddts.Ecrit) - 1 cddts.Ecrit(i) = 0 Next For i = 0 To UBound(cddts.Oral) - 1 cddts.Oral(i) = 0 Next cddts.Fac = 0 cddts.Region = 0 Tindex(Selectedclef - 2).Suppr = True FilePut(nf, cddts, Selectedclef) End Sub Public Sub LectBdD() REM destiné a évoluer Dim i As Integer For i = 0 To PosMAX - 1 REM UBound(Tindex) -1, car le tableau est déjà alloué, mais ajoute des items vides dans CBNP. 'MsgBox("i : " & i & vbNewLine & "ClefMax : " & ClefMAX & vbNewLine & "Nom : " & Tindex(i).nom) If Tindex(i).Suppr = False Then FrmEdit.CBNP.Items.Add(Format(i + 2, "00") & " - " & Tindex(i).nom & " " & Tindex(i).prenom) End If 'FileGet(nf, cddts, i) 'FrmEdit.CBNP.Items.Add(Format(i + 2, "00") & " - " & cddts.Nom & " " & cddts.Prenom) Next i End Sub Sub DetectModif() End Sub End Module