troubleshooting Question

Get Value From Datagridview at Cell_Formatting event.

Avatar of emi_sastra
emi_sastra asked on
Microsoft AccessVisual Basic.NET
4 Comments1 Solution395 ViewsLast Modified:

Why the remark code generate exception?

Thank you.

Private Sub dgvMISSTOK_CellFormatting(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellFormattingEventArgs) Handles dgvMISSTOK.CellFormatting
        With dgvMISSTOK
            If .Rows.Count = 1 Then Exit Sub
            Dim strBahanCode As String = .Item(2, e.RowIndex).Value.ToString          
            Dim dblSisaStok As Double = .Item(4, e.RowIndex).Value
           'Dim strBahanCode As String = .Rows(.CurrentCell.RowIndex).Cells("BahanCode").Value.ToString
            'Dim strBahanCode As String = dgvMISSTOK.CurrentRow.Cells("BahanCode").Value.ToString
            Select Case .Columns(e.ColumnIndex).Name
                Case "QtyStokBesar"
                    e.Value = Get_Qty_Satuan_Besar_Stok_Bahan(strBahanCode, dblSisaStok, strConnection)
                Case "QtyStokKecil"
                    e.Value = Get_Qty_Satuan_Kecil_Stok_Bahan(strBahanCode, dblSisaStok, strConnection)
            End Select
        End With
    End Sub
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 4 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros