Results 1 to 12 of 12

Thread: [RESOLVED] need help for multi display picturebox when selecting datagridview in vb.net

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2021
    Posts
    91

    Resolved [RESOLVED] need help for multi display picturebox when selecting datagridview in vb.net

    Dear All Master,
    please provide a solution to display multi picturebox when selecting datagridview.
    and is it possible to display images from subfolders?
    and can I hide datatable in datagridview in column FILENAME1,FILENAME2,FILENAME,FILENAME 4 on my select and show image in multi picturebox?
    for information i use visual studio 2010.

    Code:
    Public Class Form1
        Dim Path As String = "C:\Users\Administrator\Desktop\DBF"
        Dim Pathimage As String = "C:\Users\Administrator\Desktop\CATALOG"
        Dim cn = "provider=Microsoft.Jet.OLEDB.4.0; data source=" & Path & "; Extended Properties=dBase IV"
    Private Sub PopulateDataGridView()
            Try
                Dim dt = New DataTable()
    
                Dim query = "select ITM,ITC,QOH,PRS,FILENAME1,FILENAME2,FILENAME3,FILENAME4 FROM ITEM"
    
                Using adapter As New OleDbDataAdapter(query, cn.ToString)
                    adapter.Fill(dt)
                End Using
    
                Me.DataGridView1.DataSource = dt
     Catch myerror As OleDbException
                MessageBox.Show("Error: " & myerror.Message)
            Finally
            End Try
        End Sub
    Private Sub DataGridView1_CellContentClick(ByVal sender As Object, ByVal e As DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick
            Dim dgv As DataGridView = CType(sender, DataGridView)
            Dim thisCell As DataGridViewCell = dgv.SelectedCells(0)
            Dim selCell As Integer = thisCell.ColumnIndex
            TextBox2.Text = Pathimage & "\" & DataGridView1.CurrentRow.Cells(selCell).Value.ToString()
            If Not (pbAdder.Image Is Nothing) Then
                pbAdder.Image.Dispose()
                pbAdder.Image = Nothing
    
            End If
    
            pbAdder.Image = Image.FromFile(TextBox2.Text)
        End Sub
    Attached Images Attached Images  

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