CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2008
    Posts
    80

    Upgrade issue : Constructor call is valid only as the first statement

    I am upgrading VB6 to VB.Net

    here is the code giving me the error

    Code:
    Public Sub oCustomTask2_Trans_Sub1(ByVal oCustomTask2 As Object)
    
    Dim oTransformation As DTS.Transformation2
    
    oTransformation = oCustomTask2.Transformations.New("DTS.DataPumpTransformCopy")
    Error 168 Constructor call is valid only as the first statement in an instance constructor.

    whats the meaning of that and how can i resolve that?

    here is the upgrade warning given by Upgrade vizard


    'UPGRADE_WARNING: Couldn't resolve default property of object oCustomTask2.Transformations. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
    Last edited by saratk; February 19th, 2008 at 01:26 AM.

  2. #2
    Join Date
    Jan 2005
    Location
    City of Smiles!
    Posts
    125

    Re: Upgrade issue : Constructor call is valid only as the first statement

    just a thought:

    usually when instantiating objects, it would be like

    Code:
    Dim oTransformation As DTS.Transformation2
    oTransformation = New DTS.Transformation2
    or

    Code:
    Dim oTransformation As New DTS.Transformation2
    ...we get by with a little help from our friends...

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

Featured