vb.net problem about refresh pictures in datagridview

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lucoin
    New Member
    • Sep 2007
    • 24

    vb.net problem about refresh pictures in datagridview

    as add imagecolumn to the datagridview which contains the photo path.
    the problem I have to click the button twice, then the picture comes. the code as follows.
    Code:
            Dim ds As DataSet
            ds = AuctionComm.GetAuctions()
            dgAuction.Columns.Clear()
            dgAuction.Columns.Add(PhotoColumn)
            dgAuction.DataSource = ds.Tables("Auctions")
            RefreshRows(dgAuction)
            With PhotoColumn
                .ImageLayout = DataGridViewImageCellLayout.Zoom
                .Name = "Details"
            End With
    
            Dim rowcount As Integer = datagridview1.Rows.Count()
            For i As Integer = 0 To rowcount - 1
                PhotoColumn.DataGridView.Rows(i).Cells("Details").Value = Image.FromFile(Application.StartupPath + datagridview1.Rows(i).Cells("Photo").Value.ToString())
            Next
    I tried to place the loop to any where wthin the code area, but all dosen't works.

    Anybody help.
Working...