1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
| Private Sub Form6_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim TableInci As New DataTable
Dim LeDataSet As New DataSet
Dim i As Integer
Dim Mycommand As OleDbCommand = OleDbConnection2.CreateCommand()
Try
OleDbConnection2.Open()
Mycommand.CommandText = "SELECT [No d'incident], [Date de modification], [Description courte], [Description (Dernière mise à jour)], [Description (Historique)] FROM ResultatBO"
OleDbDataAdapter1.SelectCommand = Mycommand
OleDbDataAdapter1.Fill(LeDataSet, "ResultatBO")
OleDbConnection2.Close()
Call AfficheIncident(LeDataSet)
Call majPosition(LeDataSet)
Catch ex As Exception
MsgBox(ex.Message)
OleDbConnection2.Close()
Finally
OleDbConnection2.Close()
End Try
End Sub
'Private Sub btn_precedent_Click(ByVal sender As System.Object, ByVal e As System.EventArgs, ByVal LeDataSet As DataSet) Handles btn_precedent.Click
'Me.BindingContext(LeDataSet, "ResultatBO").Position -= 1
'majPosition(LeDataSet)
'End Sub
'Private Sub btn_suivant_Click(ByVal sender As System.Object, ByVal e As System.EventArgs, ByVal LeDataSet As DataSet) Handles btn_suivant.Click
'Me.BindingContext(LeDataSet, "ResultatBO").Position += 1
'majPosition(LeDataSet)
'End Sub
Private Sub majPosition(ByVal LeDataSet)
Dim imax, icur As Integer
imax = Me.BindingContext(LeDataSet, "ResultatBO").Count
If imax = 0 Then
affPos.Text = "(0)"
Else
icur = Me.BindingContext(LeDataSet, "ResultatBO").Position + 1
affPos.Text = icur.ToString & " / " & imax.ToString
End If
End Sub
Private Sub AfficheIncident(ByVal LeDataSet)
Dim ResReq As DataTable
Dim UnEnreg As DataRow
Dim IndiceIncident As Integer
ResReq = LeDataSet.Tables("ResultatBO")
UnEnreg = ResReq.Rows(IndiceIncident)
'Affecter les champs de la base à linterface
txt_date.Text = UnEnreg(1)
txt_num_incident.Text = UnEnreg(0)
txt_desc_courte.Text = UnEnreg(2)
txt_desc_longue.Text = UnEnreg(3)
txt_desc_longue.Text = UnEnreg(4)
End Sub |
Partager