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. Form Loading in VB .net [modified]

Form Loading in VB .net [modified]

Scheduled Pinned Locked Moved Visual Basic
questioncsharpdockerhelp
8 Posts 4 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.
  • N Offline
    N Offline
    No e
    wrote on last edited by
    #1

    Not sure what I did here, I am new to .net and have been thrown into upgrading an app. I have a main form and a sub form and the upgrade wizard seemed to do a upgrade to teh form load and called "frmChamber.definstance.show(). This was all working very well as I moved on to other items. (working on controls and menus for that form) I think I got all that working but now I have trouble loading the form. All I changed the sub form is adding context menus and some text boxes to labels and such) one of the first things the form does is open a comm port mcomm1.portopen = true , now I get an error "object reference set to an instance of an object" when I try to do that. I get the same error when I do dim frmChamber as new frmChamber frmChamber.show() I get the same error on the dim statement (before the show event) what is the proper way to load a form? What am I doing wrong, this was working before.... the message is thrown on the line Me.components = New System.ComponentModel.Container in the InitializeComponent() section. I load a different form before this one and it works fine... no-e

    modified on Tuesday, June 16, 2009 11:16 AM

    D H 2 Replies Last reply
    0
    • N No e

      Not sure what I did here, I am new to .net and have been thrown into upgrading an app. I have a main form and a sub form and the upgrade wizard seemed to do a upgrade to teh form load and called "frmChamber.definstance.show(). This was all working very well as I moved on to other items. (working on controls and menus for that form) I think I got all that working but now I have trouble loading the form. All I changed the sub form is adding context menus and some text boxes to labels and such) one of the first things the form does is open a comm port mcomm1.portopen = true , now I get an error "object reference set to an instance of an object" when I try to do that. I get the same error when I do dim frmChamber as new frmChamber frmChamber.show() I get the same error on the dim statement (before the show event) what is the proper way to load a form? What am I doing wrong, this was working before.... the message is thrown on the line Me.components = New System.ComponentModel.Container in the InitializeComponent() section. I load a different form before this one and it works fine... no-e

      modified on Tuesday, June 16, 2009 11:16 AM

      D Offline
      D Offline
      dan sh
      wrote on last edited by
      #2

      No-e wrote:

      "object reference set to an instance of an object"

      Hint: Something is nothing.

      जय हिंद

      modified on Tuesday, June 16, 2009 11:50 AM

      C N 2 Replies Last reply
      0
      • D dan sh

        No-e wrote:

        "object reference set to an instance of an object"

        Hint: Something is nothing.

        जय हिंद

        modified on Tuesday, June 16, 2009 11:50 AM

        C Offline
        C Offline
        Colin Angus Mackay
        wrote on last edited by
        #3

        Nothing in VB :)

        D 1 Reply Last reply
        0
        • C Colin Angus Mackay

          Nothing in VB :)

          D Offline
          D Offline
          dan sh
          wrote on last edited by
          #4

          Thanks for correcting. :)

          जय हिंद

          1 Reply Last reply
          0
          • D dan sh

            No-e wrote:

            "object reference set to an instance of an object"

            Hint: Something is nothing.

            जय हिंद

            modified on Tuesday, June 16, 2009 11:50 AM

            N Offline
            N Offline
            No e
            wrote on last edited by
            #5

            sorry, typo, error is "Object Reference not set to an instance of an object" the error appears in the InitializeComponent Me.components = New System.ComponentModel.Container Is it possible a control I added to teh form could cause this? (I added a context menu and a label)

            1 Reply Last reply
            0
            • N No e

              Not sure what I did here, I am new to .net and have been thrown into upgrading an app. I have a main form and a sub form and the upgrade wizard seemed to do a upgrade to teh form load and called "frmChamber.definstance.show(). This was all working very well as I moved on to other items. (working on controls and menus for that form) I think I got all that working but now I have trouble loading the form. All I changed the sub form is adding context menus and some text boxes to labels and such) one of the first things the form does is open a comm port mcomm1.portopen = true , now I get an error "object reference set to an instance of an object" when I try to do that. I get the same error when I do dim frmChamber as new frmChamber frmChamber.show() I get the same error on the dim statement (before the show event) what is the proper way to load a form? What am I doing wrong, this was working before.... the message is thrown on the line Me.components = New System.ComponentModel.Container in the InitializeComponent() section. I load a different form before this one and it works fine... no-e

              modified on Tuesday, June 16, 2009 11:16 AM

              H Offline
              H Offline
              Henry Minute
              wrote on last edited by
              #6

              Apart from anything that others might mention, and assuming it is not another typo this line:

              dim frmChamber as new frmChamber <======== problem line
              frmChamber.show()

              is trying to create a member with the same name as the class. I'm essentially a C# chap but I think you might do better with this:

              dim _frmChamber as new frmChamber <======== Note underscore added, ditto on line below
              _frmChamber.show()

              [Edit] Incidentally I hate the use of underscores in member names, but I see this in a lot of the VB.Net posts, so I used it here. If there are better VB naming conventions, use one of those. :) [/Edit]

              Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

              N 1 Reply Last reply
              0
              • H Henry Minute

                Apart from anything that others might mention, and assuming it is not another typo this line:

                dim frmChamber as new frmChamber <======== problem line
                frmChamber.show()

                is trying to create a member with the same name as the class. I'm essentially a C# chap but I think you might do better with this:

                dim _frmChamber as new frmChamber <======== Note underscore added, ditto on line below
                _frmChamber.show()

                [Edit] Incidentally I hate the use of underscores in member names, but I see this in a lot of the VB.Net posts, so I used it here. If there are better VB naming conventions, use one of those. :) [/Edit]

                Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

                N Offline
                N Offline
                No e
                wrote on last edited by
                #7

                Thanks, I think I found the problem. As part of my learning curve I added control to a form (a label). I then tried to rename it and got an error as it had apparently figured out that I had actually declared it in my code. I thought I then deleted it but after chasing this down for a bit I found that on the design view that the control re-appeared under a different name. I just deleted it and it works again. bug in Visual studio? No-e

                H 1 Reply Last reply
                0
                • N No e

                  Thanks, I think I found the problem. As part of my learning curve I added control to a form (a label). I then tried to rename it and got an error as it had apparently figured out that I had actually declared it in my code. I thought I then deleted it but after chasing this down for a bit I found that on the design view that the control re-appeared under a different name. I just deleted it and it works again. bug in Visual studio? No-e

                  H Offline
                  H Offline
                  Henry Minute
                  wrote on last edited by
                  #8

                  Don't know about a specific bug, but the Designer can get screwed from time to time, by things like that. Anyway, good luck! :)

                  Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

                  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