Söylediklerinin yanında projeye birtanede datagridview eklenecek (
AllowUserToAddRows seçeneği False olsun yoksa program sona gelindiğinde çöker) bunu gizli hale getirebilirsin işi kolaylaştırmak için böyle yaptım bin\Debug Klasörünün içinde Resimlerim isminde bir klasör oluştur istediğin resimleri bu klasöre kopyala program bu klasörün içindeki resimleri sen butonlara bastıkça görüntüleyecek. Hangi dilde bir proje istediğini yazmamışsın ben VB.NET ile yazdım eğer sen C# ile istiyorsan online dönüştürme siteleri var burdan çevirebilirsin internetimi kapattırdığım için arada evdekilerin telefonundan bağlanıyorum zor oluyor bu yüzden dönüştürme gerekirse diğer arkadaşlar yardım etsin
Form1.Designer.vb
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.DataGridView1 = New System.Windows.Forms.DataGridView()
Me.PictureBox1 = New System.Windows.Forms.PictureBox()
Me.Button1 = New System.Windows.Forms.Button()
Me.Button2 = New System.Windows.Forms.Button()
Me.Label1 = New System.Windows.Forms.Label()
CType(Me.DataGridView1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'DataGridView1
'
Me.DataGridView1.AllowUserToAddRows = False
Me.DataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize
Me.DataGridView1.Location = New System.Drawing.Point(1, 285)
Me.DataGridView1.Name = "DataGridView1"
Me.DataGridView1.Size = New System.Drawing.Size(616, 93)
Me.DataGridView1.TabIndex = 0
'
'PictureBox1
'
Me.PictureBox1.Location = New System.Drawing.Point(136, 43)
Me.PictureBox1.Name = "PictureBox1"
Me.PictureBox1.Size = New System.Drawing.Size(299, 216)
Me.PictureBox1.TabIndex = 1
Me.PictureBox1.TabStop = False
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(37, 12)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(75, 23)
Me.Button1.TabIndex = 2
Me.Button1.Text = "Button1"
Me.Button1.UseVisualStyleBackColor = True
'
'Button2
'
Me.Button2.Location = New System.Drawing.Point(456, 12)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(75, 23)
Me.Button2.TabIndex = 3
Me.Button2.Text = "Button2"
Me.Button2.UseVisualStyleBackColor = True
'
'Label1
'
Me.Label1.Location = New System.Drawing.Point(136, 12)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(299, 23)
Me.Label1.TabIndex = 4
Me.Label1.Text = "Label1"
Me.Label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
'
'Form1
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(629, 402)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.PictureBox1)
Me.Controls.Add(Me.DataGridView1)
Me.Name = "Form1"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "Form1"
CType(Me.DataGridView1, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
Friend WithEvents DataGridView1 As System.Windows.Forms.DataGridView
Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Button2 As System.Windows.Forms.Button
Friend WithEvents Label1 As System.Windows.Forms.Label
End Class
Form1.vb
Imports System.IO
Public Class Form1
Public Table As New DataTable
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim di As New IO.DirectoryInfo(My.Application.Info.DirectoryPath & "\Resimlerim")
Dim aryFi As IO.FileInfo() = di.GetFiles("*.jpg")
Dim fi As IO.FileInfo
Table.Columns.Add("Resimler", GetType(String))
For Each fi In aryFi
Table.Rows.Add(fi.FullName)
Next
DataGridView1.DataSource = Table
If Me.DataGridView1.RowCount > 0 Then
PictureBox1.Image = Image.FromFile(Me.DataGridView1.Item(0, 0).Value.ToString)
Me.DataGridView1.Rows(0).Selected = True
Me.DataGridView1.CurrentCell = Me.DataGridView1.Rows(0).Cells(0)
Me.Label1.Text = Path.GetFileNameWithoutExtension(Me.DataGridView1.Item(0, Me.DataGridView1.CurrentCell.RowIndex).Value.ToString)
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim resim As String
Dim satır As New Integer
satır = Me.DataGridView1.CurrentCell.RowIndex
If 0 < satır Then
resim = Me.DataGridView1.Rows(satır - 1).Cells(0).Value.ToString
Me.DataGridView1.Rows(satır - 1).Selected = True
Me.DataGridView1.CurrentCell = Me.DataGridView1.Rows(satır - 1).Cells(0)
Me.Label1.Text = Path.GetFileNameWithoutExtension(Me.DataGridView1.Item(0, Me.DataGridView1.CurrentCell.RowIndex).Value.ToString)
Me.PictureBox1.Image = Image.FromFile(resim)
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim resim As String
Dim satır As New Integer
satır = Me.DataGridView1.CurrentCell.RowIndex
If satır < Me.DataGridView1.RowCount - 1 Then
resim = Me.DataGridView1.Rows(satır + 1).Cells(0).Value.ToString
Me.DataGridView1.Rows(satır + 1).Selected = True
Me.DataGridView1.CurrentCell = Me.DataGridView1.Rows(satır + 1).Cells(0)
Me.Label1.Text = Path.GetFileNameWithoutExtension(Me.DataGridView1.Item(0, Me.DataGridView1.CurrentCell.RowIndex).Value.ToString)
Me.PictureBox1.Image = Image.FromFile(resim)
End If
End Sub
End Class
:tongue: