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
| Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
update_ds_personne()
TextBox1.DataBindings.Add("Text", Ds.Tables("Personne"), "prenom")
ListBox1.DataSource = Ds.Tables("Personne")
ListBox1.DisplayMember = "nom"
PictureBox1.SizeMode = PictureBoxSizeMode.Zoom
PictureBox1.DataBindings.Add("ImageLocation", Ds.Tables("Personne"), "image")
Label1.DataBindings.Add("Text", Ds.Tables("Personne"), "title")
Label2.DataBindings.Add("Text", Ds.Tables("Personne"), "commentaire")
End Sub
Sub update_ds_personne()
' Désactivation des contraintes d'unicité lors du chargement des données dans le dataset
Ds.EnforceConstraints = False
Ds.Personne.AddPersonneRow("Boudha", "Peste", "c:\gemma-atkinson.jpg", "Blond Girl", "Joli Cadeau")
Ds.Personne.AddPersonneRow("Brave", "Pit", "c:\Assassin - Touche d espoir Pochette CD.jpg", "Black Panther", _
"Attention je mords")
Ds.Personne.AddPersonneRow("Prince", "Déchu", "c:\adriana-lima-1024x768.jpg", "Latina Girl", _
"Fraîche, tel une fleur de jasmin, elle s'épanouit à la venue du soleil du printemps")
' Réactivation des contraintes d'unicité
Ds.EnforceConstraints = True
' _____________________________________________
End Sub |
Partager