السلام عليكم
مثلا لدي جدول يحتوي صور كثيرة
واريد ان اعرض هذه الصور في الفورم
بحيث في بداية الامر يعرض اول صورة ثم بعد ثواني احددها من اعدادات
يعرض بقية الصور بشكل متتالي
هل ممكن عمل هذه الفكرة
وشكرا
Public Class Form1
Dim str As String = "provider=microsoft.ace.oledb.12.0;data source=|datadirectory|\db.accdb"
Dim con As New OleDbConnection(str)
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Dim ofd As New OpenFileDialog
'ofd.Filter = "Jpg (*.jpg)|*.jpg"
If ofd.ShowDialog = Windows.Forms.DialogResult.OK Then
Dim b() As Byte = My.Computer.FileSystem.ReadAllBytes(ofd.FileName)
Dim cm As New OleDbCommand("insert into tb (pic) values(@pic)", con)
cm.Parameters.AddWithValue("@pic", b)
If con.State = ConnectionState.Closed Then
con.Open()
End If
Try
cm.ExecuteNonQuery()
gd()
pos()
If con.State = ConnectionState.Open Then
con.Close()
End If
Catch ex As Exception
If con.State = ConnectionState.Open Then
con.Close()
End If
MsgBox(Err.Description, MsgBoxStyle.Critical)
End Try
End If
End Sub
Dim ds As New DataSet
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
gd()
pos()
End Sub
Private Sub gd()
ds.Clear()
PictureBox1.DataBindings.Clear()
Dim da As New OleDbDataAdapter("select * from tb", con)
da.Fill(ds, "tb")
PictureBox1.DataBindings.Add("image", ds, "tb.pic", True)
End Sub
Private Sub pos()
Label1.Text = " السجل رقم: " & Me.BindingContext(ds, "tb").Position & " من " & Me.BindingContext(ds, "tb").Count
End Sub
Dim norm As Boolean = True
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
If norm Then
Me.BindingContext(ds, "tb").Position += 1
pos()
Else
Me.BindingContext(ds, "tb").Position -= 1
pos()
End If
If Me.BindingContext(ds, "tb").Position = Me.BindingContext(ds, "tb").Count - 1 Then
' Me.BindingContext(ds, "tb").Position = 0
norm = False
pos()
ElseIf Me.BindingContext(ds, "tb").Position = 0 Then
norm = True
pos()
End If
End Sub
Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick
If Timer1.Enabled Then
Label2.Text = "التصفح التلقائي يعمل"
Else
Label2.Text = "التصفح التلقائي لا يعمل"
End If
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If Timer1.Enabled = False Then
Timer1.Enabled = True
Else
Timer1.Enabled = False
End If