Upgrading VB 6 to VB.NET

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • foocc
    New Member
    • Feb 2007
    • 13

    Upgrading VB 6 to VB.NET

    Hi, im currently doing an upgrade from vb6 to vb.net with the help of code advisor. Im also new to vb.net.

    However, im still facing some problems modifying existing codes to perform the conversion. Below is the message showing that I need to modify the codes.

    'FIXIT: 'lstItem.ForeCo lor' is not a property of the generic 'Form' object in Visual Basic .NET. To access 'lstItem.ForeCo lor' declare 'obj' using its actual type instead of 'Form' FixIT90210ae-R1460-RCFE85
    obj.lstItem.For eColor = &HFF& 'red

    The problem here is how do i modify it?...I really dont have any idea on how to do that.

    Actually I have also read through the msdn but it didnt do any help as the example given is the issue :

    'Value' is not a property of the generic 'Control' object in vb.net. To access 'Value' declare 'ctl' using its actual type instead of 'Control'..... Please help me.

    Many thanks.
  • willakawill
    Top Contributor
    • Oct 2006
    • 1646

    #2
    Hi. Who wrote the code that you are trying to update to .NET?
    Why are you updating this particular code to .NET?

    Comment

    • vijaydiwakar
      Contributor
      • Feb 2007
      • 579

      #3
      Originally posted by foocc
      Hi, im currently doing an upgrade from vb6 to vb.net with the help of code advisor. Im also new to vb.net.

      However, im still facing some problems modifying existing codes to perform the conversion. Below is the message showing that I need to modify the codes.

      'FIXIT: 'lstItem.ForeCo lor' is not a property of the generic 'Form' object in Visual Basic .NET. To access 'lstItem.ForeCo lor' declare 'obj' using its actual type instead of 'Form' FixIT90210ae-R1460-RCFE85
      obj.lstItem.For eColor = &HFF& 'red

      The problem here is how do i modify it?...I really dont have any idea on how to do that.

      Actually I have also read through the msdn but it didnt do any help as the example given is the issue :

      'Value' is not a property of the generic 'Control' object in vb.net. To access 'Value' declare 'ctl' using its actual type instead of 'Control'..... Please help me.

      Many thanks.
      are u using listbox ctrl in vb? then trying to convert it into .net?
      u can also convert the code from vb to .net by directly opening the vb project from vb.net2005 edition

      Comment

      • foocc
        New Member
        • Feb 2007
        • 13

        #4
        Originally posted by vijaydiwakar
        are u using listbox ctrl in vb? then trying to convert it into .net?
        u can also convert the code from vb to .net by directly opening the vb project from vb.net2005 edition
        Hi. Yes, the existing system in vb6 is using listbox ctrl and im now trying to convert it to vb.net.

        Ive tried your way by opening it directly from vb.net 2005 and i got this :

        'FIXIT: 'lstItem.ForeCo lor' is not a property of the generic 'Form' object in Visual Basic .NET. To access 'lstItem.ForeCo lor' declare 'obj' using its actual type instead of 'Form' FixIT90210ae-R1460-RCFE85
        'UPGRADE_ISSUE: Control lstItem could not be resolved because it was within the generic namespace Form.
        obj.lstItem.ForeColor = &HFF 'red

        What should i do now? Something seems to be not right for the code in bold. How do i modify it?

        Seriously, i have no experience in vb.net before with the fact that im only a new IT trainee and my boss asks me convert the system from vb 6 to vb.net.

        Hope that u can help and guide me through this. Actually, what is the first step to do when i want to convert vb to vb.net? Do i need to modify any coding in vb 6?

        Many thanks.

        Comment

        • AricC
          Recognized Expert Top Contributor
          • Oct 2006
          • 1885

          #5
          Originally posted by foocc
          Hi. Yes, the existing system in vb6 is using listbox ctrl and im now trying to convert it to vb.net.

          Ive tried your way by opening it directly from vb.net 2005 and i got this :

          'FIXIT: 'lstItem.ForeCo lor' is not a property of the generic 'Form' object in Visual Basic .NET. To access 'lstItem.ForeCo lor' declare 'obj' using its actual type instead of 'Form' FixIT90210ae-R1460-RCFE85
          'UPGRADE_ISSUE: Control lstItem could not be resolved because it was within the generic namespace Form.
          obj.lstItem.ForeColor = &HFF 'red

          What should i do now? Something seems to be not right for the code in bold. How do i modify it?

          Seriously, i have no experience in vb.net before with the fact that im only a new IT trainee and my boss asks me convert the system from vb 6 to vb.net.

          Hope that u can help and guide me through this. Actually, what is the first step to do when i want to convert vb to vb.net? Do i need to modify any coding in vb 6?

          Many thanks.
          Will this help?

          Comment

          • Killer42
            Recognized Expert Expert
            • Oct 2006
            • 8429

            #6
            Is it possible that the code is simply referring to a control (lstItem) that no longer exists?

            Comment

            • willakawill
              Top Contributor
              • Oct 2006
              • 1646

              #7
              Originally posted by Killer42
              Is it possible that the code is simply referring to a control (lstItem) that no longer exists?
              I am much more interested that this question was ignored:
              Hi. Who wrote the code that you are trying to update to .NET?
              Why are you updating this particular code to .NET?

              Comment

              • foocc
                New Member
                • Feb 2007
                • 13

                #8
                Hi. Sorry for not answering your question. Actually, im not sure who wrote the codes as im new to the company. And im not only trying to update that code. I have a other codes with similar error and I thought tht if i could solve 1 then i can solve the other problems as well.

                Here's my other problems after using the upgrade wizard :

                'FIXIT: Declare 'objForm' with an early-bound data type FixIT90210ae-R1672-R1B8ZE
                Sub MenuControl(ByR ef objForm As Object, ByRef V1 As Boolean, ByRef V2 As Boolean, ByRef V3 As Boolean, ByRef V4 As Boolean, ByRef V5 As Boolean, ByRef V6 As Boolean)
                With objForm
                'UPGRADE_WARNIN G: Couldn't resolve default property of object objForm.mnuCrea te. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?ke yword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                .mnuCreate.Visi ble = V1
                'UPGRADE_WARNIN G: Couldn't resolve default property of object objForm.mnuChan ge. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?ke yword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                .mnuChange.Visi ble = V2
                'UPGRADE_WARNIN G: Couldn't resolve default property of object objForm.mnuDele te. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?ke yword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                .mnuDelete.Visi ble = V3
                'UPGRADE_WARNIN G: Couldn't resolve default property of object objForm.mnuSave . Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?ke yword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                .mnuSave.Visibl e = V4
                'UPGRADE_WARNIN G: Couldn't resolve default property of object objForm.mnuCanc el. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?ke yword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                .mnuCancel.Visi ble = V5
                'UPGRADE_WARNIN G: Couldn't resolve default property of object objForm.mnuPrin t. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?ke yword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                .mnuPrint.Visib le = V6
                End With
                _______________ _______________ _______________ _______________

                'FIXIT: Declare 'objForm' with an early-bound data type FixIT90210ae-R1672-R1B8ZE
                Sub ValidateInput(B yRef objForm As Object, ByRef TF As Boolean)
                Dim target As String
                TF = True
                With objForm
                'UPGRADE_WARNIN G: Couldn't resolve default property of object objForm.txtCust Code. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?ke yword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                If .txtCustCode.Te xt = "" Then
                MsgBox("Please enter Customer Code")
                'UPGRADE_WARNIN G: Couldn't resolve default property of object objForm.txtCust Code. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?ke yword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                .txtCustCode.Se tFocus()
                TF = False
                Exit Sub
                Else
                'UPGRADE_WARNIN G: Couldn't resolve default property of object objForm.lblcmdC ustCode. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?ke yword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                If .lblcmdCustCode .Caption = "" Then
                'UPGRADE_WARNIN G: Couldn't resolve default property of object objForm.txtCust Code. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?ke yword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                Call basDetail.GetCu stName(.txtCust Code.Text, target)
                'UPGRADE_WARNIN G: Couldn't resolve default property of object target. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?ke yword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                If target = "Not Found in VB" Then
                MsgBox("Error in Customer Code")
                'UPGRADE_WARNIN G: Couldn't resolve default property of object objForm.txtCust Code. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?ke yword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                .txtCustCode.Se tFocus()
                TF = False
                Exit Sub
                Else
                'UPGRADE_WARNIN G: Couldn't resolve default property of object objForm.lblcmdC ustCode. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?ke yword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                'UPGRADE_WARNIN G: Couldn't resolve default property of object target. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?ke yword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                .lblcmdCustCode .Caption = target
                End If
                End If
                End If

                'UPGRADE_WARNIN G: Couldn't resolve default property of object objForm.txtEffe ctive. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?ke yword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                If .txtEffective.T ext = "" Then
                MsgBox("Please enter Effective Date")
                'UPGRADE_WARNIN G: Couldn't resolve default property of object objForm.txtEffe ctive. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?ke yword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                .txtEffective.S etFocus()
                TF = False
                Exit Sub
                End If

                'UPGRADE_WARNIN G: Couldn't resolve default property of object objForm.cboMaxQ ty. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?ke yword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                If .cboMaxQty.Text = "" Then
                MsgBox("Please enter Max Qty")
                'UPGRADE_WARNIN G: Couldn't resolve default property of object objForm.txtMaxQ ty. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?ke yword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                .txtMaxQty.SetF ocus()
                TF = False
                Exit Sub
                End If

                'UPGRADE_WARNIN G: Couldn't resolve default property of object objForm.cboVanQ ty. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?ke yword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                If .cboVanQty.Text = "" Then
                MsgBox("Please enter the No. of Vans to claim")
                'UPGRADE_WARNIN G: Couldn't resolve default property of object objForm.txtVanQ ty. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?ke yword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                .txtVanQty.SetF ocus()
                TF = False
                Exit Sub
                Else
                'UPGRADE_WARNIN G: Couldn't resolve default property of object objForm.cboMaxQ ty. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?ke yword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                'UPGRADE_WARNIN G: Couldn't resolve default property of object objForm.cboVanQ ty. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?ke yword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                If .cboVanQty.Text > .cboMaxQty.Text Then
                MsgBox("No. of Vans to claim must be =< Max. Qty")
                'UPGRADE_WARNIN G: Couldn't resolve default property of object objForm.txtVanQ ty. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?ke yword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                .txtVanQty.SetF ocus()
                TF = False
                Exit Sub
                End If
                End If

                'UPGRADE_WARNIN G: Couldn't resolve default property of object objForm.txtNar3 . Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?ke yword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                If .txtNar3.Text = "" Then
                MsgBox("Please enter Vehicles No in Narration line 3")
                'UPGRADE_WARNIN G: Couldn't resolve default property of object objForm.txtNar3 . Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?ke yword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                .txtNar3.SetFoc us()
                TF = False
                Exit Sub
                End If

                End With
                End Sub
                _______________ _______________ _______________ ___________
                How do i solve this?

                Many thanks

                Comment

                • Killer42
                  Recognized Expert Expert
                  • Oct 2006
                  • 8429

                  #9
                  The "FIXIT" entries sound as though they might go away if you just declare objForm as type Form rather than the more generic Object. I'm not sure you need to do anything about the upgrade warnings.

                  (This is pure guesswork, though.)

                  Comment

                  • willakawill
                    Top Contributor
                    • Oct 2006
                    • 1646

                    #10
                    Originally posted by foocc
                    Hi. Sorry for not answering your question. Actually, im not sure who wrote the codes as im new to the company. And im not only trying to update that code. I have a other codes with similar error and I thought tht if i could solve 1 then i can solve the other problems as well.
                    Many thanks
                    Yes I had a hunch that this was not code you had written yourself. I still don't understand why you feel the need to 'update' the code to a different compiler.

                    Comment

                    • Killer42
                      Recognized Expert Expert
                      • Oct 2006
                      • 8429

                      #11
                      Originally posted by willakawill
                      Yes I had a hunch that this was not code you had written yourself. I still don't understand why you feel the need to 'update' the code to a different compiler.
                      Yeah, go and tell your boss that willakawill says you don't need to do it. ;)

                      Don't worry, we've got a special forum where you can look for a new job.

                      Comment

                      • foocc
                        New Member
                        • Feb 2007
                        • 13

                        #12
                        Originally posted by willakawill
                        Yes I had a hunch that this was not code you had written yourself. I still don't understand why you feel the need to 'update' the code to a different compiler.
                        Hi. Really? There's a forum to look for new jobs? However, this is actually my internship program, so unfortunately i have to go on, whether there is actually the need to upgrade the system or not.

                        So, i could really use a little more help here.

                        Ive got this warning :Variable 'drRate' is used before it has been assigned a value. A null reference exception could result at runtime.

                        What exactly is the problem here?....and how do i solve it?

                        Code:
                        Public Sub mnuStdRateList_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles mnuStdRateList.Click
                        	Dim drRate As Object
                        	Dim drVRate As Object
                        	Dim strTitle As Object
                        	'UPGRADE_WARNING: Couldn't resolve default property of object strTitle. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                        	strTitle = "List of Standard Rate as at " & Now
                        	'UPGRADE_WARNING: Couldn't resolve default property of object drVRate.Title. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                        	'UPGRADE_WARNING: Couldn't resolve default property of object strTitle. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                        	drVRate.Title = strTitle
                        	deWVA.rscmdVRate.Properties.Refresh()
                        	'UPGRADE_WARNING: Couldn't resolve default property of object drRate.Show. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                        	[B]drRate[/B].Show(1)
                        End Sub
                        Many thanks.
                        Last edited by Killer42; Mar 1 '07, 08:36 AM. Reason: Please use CODE tags around your code.

                        Comment

                        • Killer42
                          Recognized Expert Expert
                          • Oct 2006
                          • 8429

                          #13
                          Not familiar with this stuff myself, but doesn't it seem slightly unusual that you are creating an object (drRate), then "showing" it, without setting any properties or anything?

                          Comment

                          • willakawill
                            Top Contributor
                            • Oct 2006
                            • 1646

                            #14
                            Originally posted by Killer42
                            Yeah, go and tell your boss that willakawill says you don't need to do it. ;)

                            Don't worry, we've got a special forum where you can look for a new job.
                            Better still. Tell your boss that your best approach is to go on the internet and take advice from pundits who have never used .net

                            Gold star instantly :)

                            Comment

                            • Killer42
                              Recognized Expert Expert
                              • Oct 2006
                              • 8429

                              #15
                              Originally posted by willakawill
                              Better still. Tell your boss that your best approach is to go on the internet and take advice from pundits who have never used .net
                              Excellent idea. :D

                              On a slightly more serious note foocc, have you asked about this in the .Net forum? It seems likely there would be a fair bit of experience in VB upgrades to .Net over there.

                              Comment

                              Working...