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
| Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
dim tutu as integer = 100
cn = New OleDb.OleDbConnection
cn.ConnectionString = " Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\USER\Documents\hopital.mdb"
Dim Mycommand As OleDbCommand = MyConnexion.CreateCommand()
Mycommand.CommandText = "SELECT Rayon FROM hopital"
cn.Open()
Dim myReader As OleDbDataReader = Mycommand.ExecuteReader()
Do While myReader.Read()
ajoutxt(myReader.GetString(0),tutu,tutu.tostring)
tutu = tutu + 100
Loop
myReader.Close()
cn.Close()
End Sub
private sub ajoutxt (byval texte as string,byval lapositionvoulu as integer,byval LeNomDeTonCtrl as string)
dim txt as TextBox = new TextBox
with txt
.parent = me ' le parent de ton controle sera la forme
.name = LeNomDeTonCtrl
.left = 100
.top = lapositionvoulu
.width = 300
.height = 90
.visible = true
.text = texte
end with
me.controls.add(txt)
end sub |
Partager