Results 1 to 10 of 10

Thread: Display Image From dataGridView to multi picturebox in VB.NET

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2021
    Posts
    91

    Display Image From dataGridView to multi picturebox in VB.NET

    Dear All Master,



    I want the image to appear in the multi picturebox (Picturebox1-Picturebox6) when clicked on the "ITC" column in the datagridview.

    The image location is in the "path" column in the join with the "filename1-filename6" column.

    and for those without an image, it appears in the picturebox "no photo".
    I don't want to use databindings because it makes it slow and my record is fifty thousand records.

    for the record i use visual studio 2010
    Code:
    Imports System.Data.OleDb
    
    Public Class Form1
        Private WithEvents dt As New DataTable
        Dim Path As String = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
        Dim cn = "provider=Microsoft.Jet.OLEDB.4.0; data source=" & Path & "; Extended Properties=dBase IV"
        Private Sub FillDataGridView()
            Try
                'Dim dt = New DataTable()
                dt = New DataTable
                Dim query = "select ITM,ITC,QOH,PRS,FILENAME1,FILENAME2,FILENAME3,FILENAME4,FILENAME5,FILENAME6,PATH FROM ITEM"
    
                Using adapter As New OleDbDataAdapter(query, cn.ToString)
                    adapter.Fill(dt)
                End Using
                Me.DataGridView1.DataSource = dt
    
                'For x As Integer = 4 To 10
                '    Me.DataGridView1.Columns(x).Visible = False
                'Next
            Catch myerror As OleDbException
                MessageBox.Show("Error: " & myerror.Message)
            Finally
            End Try
        End Sub
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            FillDataGridView()
        End Sub
    End Class
    thanks
    roy88
    Attached Images Attached Images  
    Last edited by roy88; Jan 13th, 2022 at 04:02 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width