Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted by Zippo205 ( 13 years ago )
Option Strict On
Option Explicit On
Imports System.Data.OleDb

Public Class Form1

    Public cnxCommandes As New OleDbConnection
    Dim ComClients As New OleDbCommand
    Dim aptClients As New OleDbDataAdapter
    Dim setDonnees As New DataSet
    Dim inCompteur As Integer


    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        cnxCommandes.ConnectionString = "Provider=Microsoft.JET.OLEDB.4.0;Data Source=Commandes.mdb"
        cnxCommandes.Open()
        ComClients.CommandText = "Select CodeClient, SocieteClient, ContactClient, TelClient from [T-Clients];"
        ComClients.Connection = cnxCommandes
        aptClients.SelectCommand = ComClients
        aptClients.Fill(setDonnees, "client")
        dgvclients.DataSource = setDonnees
        dgvclients.DataMember = "client"
        txtCodeClient.Text = setDonnees.Tables("client").Rows(inCompteur)(0).ToString
        txtSoClient.Text = setDonnees.Tables("client").Rows(inCompteur)(1).ToString
        txtContactclient.Text = setDonnees.Tables("client").Rows(inCompteur)(2).ToString
        txtTelclient.Text = setDonnees.Tables("client").Rows(inCompteur)(3).ToString
    End Sub

    Private Sub btnSuivant_Click(sender As System.Object, e As System.EventArgs) Handles btnSuivant.Click
        inCompteur += 1
        If inCompteur > 89 Then
            btnSuivant.Enabled = False
        ElseIf inCompteur > 0 Then
            btnPrecedant.Enabled = True
        End If
        txtCodeClient.Text = setDonnees.Tables("client").Rows(inCompteur)(0).ToString
        txtSoClient.Text = setDonnees.Tables("client").Rows(inCompteur)(1).ToString
        txtContactclient.Text = setDonnees.Tables("client").Rows(inCompteur)(2).ToString
        txtTelclient.Text = setDonnees.Tables("client").Rows(inCompteur)(3).ToString
    End Sub

    Private Sub btnPrecedant_Click(sender As System.Object, e As System.EventArgs) Handles btnPrecedant.Click
        inCompteur -= 1
        txtCodeClient.Text = setDonnees.Tables("client").Rows(inCompteur)(0).ToString
        txtSoClient.Text = setDonnees.Tables("client").Rows(inCompteur)(1).ToString
        txtContactclient.Text = setDonnees.Tables("client").Rows(inCompteur)(2).ToString
        txtTelclient.Text = setDonnees.Tables("client").Rows(inCompteur)(3).ToString
        If inCompteur = 0 Then
            btnPrecedant.Enabled = False
        End If
        'commande pour savoir le nombre total de rangé dans un formulaire
    End Sub

    Private Sub AjouterToolStripMenuItem1_Click(sender As System.Object, e As System.EventArgs) Handles AjouterToolStripMenuItem1.Click
        Me.Hide()
        Ajouter.Show()
    End Sub
End Class

 

Revise this Paste

Your Name: Code Language: