Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Upgrade issue : Constructor call is valid only as the first statement

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

Scheduled Pinned Locked Moved Visual Basic
helpquestioncsharp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sarat
    wrote on last edited by
    #1

    I am upgrading VB6 to VB.Net here is the code giving me the error 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"'

    C 1 Reply Last reply
    0
    • S sarat

      I am upgrading VB6 to VB.Net here is the code giving me the error 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"'

      C Offline
      C Offline
      CKnig
      wrote on last edited by
      #2

      Without knowing all the background it's hard to help but: try Dim oTransformation As New DTS.Transformation2 OR: The problem is with the oTransformation = oCustomTask2.Transformations.New("DTS.DataPumpTransformCopy") part. A constructor is not a simple Method (it for example no return value) but a OPERATOR. So try oTransformation = new oCustomTask2.Transformations("DTS.DataPumpTransformCopy") But as already said: it's hard to tell without knowing the oCustomTask (is it a class with subclass Transformations? Or is it a Namespace?) and DTS.Transformation2.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups