UserForm1 code
UserForm1 code
If trouve Then
RemplirListView
MsgBox "Modification réussie !", vbInformation
Else
MsgBox "ID introuvable", vbExclamation
End If
End Sub
If trouve Then
RemplirListView
MsgBox "Suppression réussie !", vbInformation
Else
MsgBox "ID introuvable", vbExclamation
End If
End Sub
ListView1.ListItems.Clear
For i = 2 To lastRow
With ListView1.ListItems.Add(, , ws.Cells(i, 1).Value)
.SubItems(1) = ws.Cells(i, 2).Value
.SubItems(2) = ws.Cells(i, 3).Value
.SubItems(3) = ws.Cells(i, 4).Value
.SubItems(4) = ws.Cells(i, 5).Value
.SubItems(5) = Format(ws.Cells(i, 6).Value, "Currency")
.SubItems(6) = Format(ws.Cells(i, 7).Value, "Short Date")
End With
Next i
End Sub
rowNum = FindRow(id)
With ws
.Cells(rowNum, 1) = id
.Cells(rowNum, 2) = txtNom.Text
.Cells(rowNum, 3) = txtPrenom.Text
.Cells(rowNum, 4) = txtPoste.Text
.Cells(rowNum, 5) = txtDepartement.Text
.Cells(rowNum, 6) = CDbl(txtSalaire.Text)
.Cells(rowNum, 7) = CDate(txtDate.Text)
End With
End Sub
Private Sub DeleteRecord(id As Long)
Dim delRow As Long
delRow = FindRow(id)
If delRow > 1 Then
Sheets("Base de Donnee").Rows(delRow).Delete
End If
End Sub