Hello !! Sorry to bother you again..

I am making a windows app using vb.net, ms access 2003 and vs 2008..

The form i have is named BOM, it contains a datagridview that has checkboxes.. The user needs to select a row by checking on the checkbox..

These selected rows are needed to be visible in datagridview in other form, named, SelectedBom..

Its the same.. Just some renames required.. I have done them but i am getting an error which says :


'HemProject.BOM.Private WithEvents dgv1 As System.Windows.Forms.DataGridView' is not accessible in this context because it is 'Private'.

Public Class SelectedBom

    Private Sub SelectedBom_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'HemDatabase1DataSet4.partno' table. You can move, or remove it, as needed.
        'Me.PartnoTableAdapter.Fill(Me.HemDatabase1DataSet4.partno)

        Dim count As Integer = 0

        For j As Integer = 0 To BOM.dgv1.RowCount - 1

            If BOM.dgv1.Rows(j).Cells(0).Value = True Then


                For i As Integer = 0 To BOM.dgv1.ColumnCount - 1
                    Me.DataGridView2.Rows(count).Cells(i).Value = BOM.dgv1.Rows(j).Cells(i).Value
                Next

                count += 1

            End If

        Next

    End Sub
End Class

Please help me solve this.. no reference regarding this error, i could find anywhere.. M searching since long.. Please help !!

In which line the error is?

lines 10, 12, 15, 16..

There is a line under 'BOM.dgv1' and this error..

Class BOM is private? If public then goto desginer of the form and you could see
Friend WithEvents dgv1 As System.Windows.Forms.DataGridView
change to PUBLIC WithEvents dgv1 As System.Windows.Forms.DataGridView
it should work

Now there is no error but the same issue.. it gives value -1 in first column, 1st row, datagridview of SelectedBom, as an output..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.