Public Class FrmEditions ' Paramètre de connexion à ODBC Private ctDSN_AEM As String = "DSN=bd_aem;" Private szSQL As String Private rs As ADODB.Recordset Private Sub FrmEditions_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim nb As Integer = 0 ' effacer la listview LV_ETATS.Items.Clear() ' Lire les états disponibles dans la rubrique szSQL = "SELECT * FROM p_etats ORDER BY libelle;" GetRecordset(ctDSN_AEM, szSQL, rs) Do While Not rs.EOF LV_ETATS.Items.Add(rs.Fields("libelle").Value) LV_ETATS.Items(nb).SubItems.Add(nv(rs.Fields("nom_rpt").Value)) LV_ETATS.Items(nb).SubItems.Add(nv(rs.Fields("code").Value)) LV_ETATS.Items(nb).SubItems.Add(nv(rs.Fields("dates").Value)) ' Get the next record rs.MoveNext() nb = nb + 1 Loop ' Close the recordset AND connection. rs.Close() End Sub Private Sub LV_ETATS_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles LV_ETATS.DoubleClick ' un état est-il sélectionné ? If LV_ETATS.SelectedItems.Count <= 0 Then Exit Sub End If Dim noRPT As String = LV_ETATS.SelectedItems(0).SubItems(2).Text Dim szNomRPT As String = LV_ETATS.SelectedItems(0).SubItems(1).Text ' Sélection de DATES ? If LV_ETATS.SelectedItems(0).SubItems(3).Text = "OUI" Then frmDates.ShowDialog() ' dates saisies ? If frmDates.pSelection.Length > 0 Then FrmViewReport.pParamRPT = frmDates.pSelection Else Exit Sub End If Else FrmViewReport.pParamRPT = "" End If ' édition de l'état RPT FrmViewReport.pCodeEtat = noRPT FrmViewReport.ShowDialog() End Sub Private Sub LV_ETATS_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles LV_ETATS.KeyDown ' touche Enter = DoubleClick If e.KeyCode = Keys.Enter Then LV_ETATS_DoubleClick(sender, e) End If End Sub End Class