troubleshooting Question

Exposing DataGridView properties in a Class in VB.NET 2013

Avatar of Peter Allen
Peter AllenFlag for United States of America asked on
Visual Basic.NETMicrosoft Development
11 Comments3 Solutions570 ViewsLast Modified:
I have the following code in VB.NET 2008 which works just fine.  However, when I port this code into VB.NET 2013 project the DataGridView reference doesn't exist.

Public Function fncInitializeDataGridView_GenerateControl _
           ( _

           ByRef oDataGridView As DataGridView, _
           ByRef dsDataSet As DataSet _
           ) _
            As DataGridView
        'Function Parameter Variables
        '  oDataGridView  DataGridView Control from Form
        '  dsDataSet      DataSet containing DataGridView datatable(s)
        'Function General Variables
        ' sFormName       Form Name
        ' sCtrlName       Control Name
        'Function Returns DataGridView Control
        Dim sFormName As String = oDataGridView.Parent.Name
        Dim sCtrlName As String = oDataGridView.Name
        Call fncInitializeDataGridView_ControlSetup(oDataGridView, dsTempTables)
        Call fncInitializeDataGridView_ControlProperties(oDataGridView)
        Call fncInitializeDataGridView_ControlColumnSetup(oDataGridView, dsDataSet)
        oclsDataGridView_XMLProcessing.subSaveDataGridViewXMLSettings(sFormName, sCtrlName)
        If dsDataSet.Tables.Count > 0 Then
            Call subBuildTables_InitializeTempDataSet(dsDataSet)
            Call subBuildTables_InitializeDataGridView(oDataGridView)
            Call subBuildDGView_PopulateTempDataSet(dsDataSet, dsTempTables)
            Call subBuildDGView_PopulateDataGridView(oDataGridView, dsTempTables)
        End If
        Return oDataGridView
    End Function

I get a "syntax error on the first "Byref" and the "Return oDataGridView" lines.  In VB.NET 2008 the DataGridView was available, but in VB.NET 2013 it is somewhere else which makes me think that I have to add references to the class.  Would this be correct?  

Thanks for your assistance.
Join our community to see this answer!
Unlock 3 Answers and 11 Comments.
Start Free Trial
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 3 Answers and 11 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