|
|
|
| Remplir un combobox dans VB.Net (urgent SVP) par Nathalie |
lundi 20 septembre 2004 à 13:02:23 |
Salut Nathalie,
Voici un exemple, a+ Sub RemplirComboTOTO() Dim cmdSelect As OleDbCommand = New OleDbCommand Dim drListeTOTO As OleDbDataReader OuvrirConnexion() With cmdSelect .Connection = cnBdD .CommandType = CommandType.Text .CommandText = "SELECT * FROM TOTO" End With drListeTOTO = cmdSelect.ExecuteReader() While drListeTOTO.Read() ComboBoxTOTO.Items.Add(drListeTOTO!TOTOCHAMPS) End While drListeTOTO.Close() FermerConnexion() End Sub Sub OuvrirConnexion() sConnexion = "Provider=Microsoft.Jet.OLEDB.4.0;" sConnexion &= "Password=;User ID=Admin;" sConnexion &= "Data Source=C:\TOTO.mdb" cnBdD = New OleDbConnection(sConnexion) Try cnBdD.Open() Catch ex As Exception MessageBox.Show(ex.Message, "Message d'alerte", MessageBoxButtons.OK, MessageBoxIcon.Error) End Try End Sub Sub FermerConnexion() Try cnBdD.Close() Catch ex As Exception MessageBox.Show(ex.Message, "Message d'alerte", MessageBoxButtons.OK, MessageBoxIcon.Error) End Try End Sub |
| 05/12 12h10 | [VB.NET] Mise à jour d'une combobox | Programmation | 05/12 13h13 | 1 |
| 14/06 05h32 | [VB.net] Afficher données d'un combobox | Programmation | 07/04 19h52 | 1 |
| 02/02 16h32 | VB .NET / ComboBox | Programmation | 26/08 11h40 | 1 |
| 31/10 14h36 | [VB.NET] pointer val. de inputbox -> combobox | Programmation | 31/10 14h36 | 0 |