Option Explicit On
Public Class Form1
Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim i As Long
ComboBox1.Visible = False
For i = 1 to ?
ComboBox1.Items.Add(ta data)
Next i
End Sub
Sub Form1_Shown(sender As Object, e As EventArgs) Handles Me.Shown
ComboBox1.Visible = True
End Sub
End Class
Public Sub LoadListBox(ByRef oLst As System.Windows.Forms.ComboBox, ByVal sPath As String)
Try
Dim reader As System.IO.StreamReader
Dim line As String
reader = File.OpenText(sPath)
While reader.Peek <> -1
oLst.Items.Add(reader.ReadLine() )
End While
reader.Close()
Catch ex As Exception
MsgBox("ERREUR : " & err.number & vblf & err.description)
End Try
End Sub
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionPrivate Sub LoadListBox(oLst As ComboBox, sPath As String) Try oLst.Items.AddRange(File.ReadAllLines(sPath)) Catch ex As Exception End Try End Sub