I was trying to make a program that shows picture in a folder. The path of each picture was stored in the database. My problem was it only show the last images stored in the database and not all the pictures.
code:
Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Timer1.Enabled = True
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Try
Dim ctr As Integer = 0
Dim pic As String
Dim sqlconn As New SqlConnection("data source=NMPI_2;initial catalog=IPCS; " & _
"password=rhyatco; " & _
"persist security info=True; " & _
"user id= rhyatco;" & _
"packet size=4096")
sqlconn.Open()
Dim query As String = "Select picture from Bpicture"
Dim sqlcomm As New SqlCommand(query, sqlconn)
Dim reader As SqlDataReader
reader = sqlcomm.ExecuteReader
While reader.Read
pic = reader("picture").ToString
Me.PictureBox1.Image = Image.FromFile(pic)
Me.PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage
End While
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
any help? thanks