topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday December 12, 2024, 2:39 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Help! Visual Basic is stealing my objects and giving me errors!  (Read 6147 times)

wreckedcarzz

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 1,626
    • View Profile
    • Donate to Member
Been having a problem ever since I have been using VB, and I can never fix it - it has gotten to the point of "fix it or forget it", and obviously I don't want to leave some wierd bug in a program.

This doesn't act like a normal bug - it is random, and it occurs only with specific items. Timers, panels, pictureboxes are several of the items that have issues. Anything that goes into the container box at the bottom of the designer is a potential target - buttons, labels, and other controls are somehow unaffected. :huh:

This time, it is a timer. And it was there. I ran it. And then... its not there. No trace in the component tray, the form, or in the list of objects on the form in the Properties window. So, no big deal - its a timer, not a button with 50 lines of code. I added a new timer control, named "tmrTyping", and all seemed well.

Except it brought along with it an error - the error I can not, for the life of me, fix:

Error 2 'components' is already declared as 'Private components As System.ComponentModel.IContainer' in this class. C:\Users\Brandon\Documents\Visual Studio 2008\Projects\SnapSuite 2009\SnapSuite 2009\Notes.vb 27 13 SnapSuite 2009

If I comment out or delete the line, the error turns to a warning of:

Warning 1 The variable 'components' is either undeclared or was never assigned. 0 0

And somehow, while writing this post, I now have BOTH of the above.. what the h*ll?? :huh: >:(


My current "fix" for this is to start a WHOLE NEW project, and bring all the controls over, re-do the settings for everything, copy the code, and sync the events with the code. There has to be a fix. Googling turned up no help whatsoever, so does any DC'er out there know anything about this? I am glad to post the entire solution in a ZIP if needed- I just need a way to fix this annoying error! :'(

Help! SOS! :tellme:

-Brandon

VideoInPicture

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 467
    • View Profile
    • Circle Dock
    • Donate to Member
Re: Help! Visual Basic is stealing my objects and giving me errors!
« Reply #1 on: September 02, 2008, 06:53 PM »
Are you declaring those Windows form objects inside of your own code or are you letting VB handle the form designer code in a separate file/region? It seems to me that you may have at some point copied some form designer code into the main body of your program which is giving VB conflicts because it can't alter that code without you explicity changing it yourself. This would explain why it is saying that 'Private components As System.ComponentModel.IContainer' is already declared because this is one of the statements that the form designer is suppose to create.
Author of Circle Dock: http://circledock.wikidot.com
Author of Video In Picture: http://videoinpicture.wikidot.com
Author of Webcam Signature: http://webcamsignature.wikidot.com
Author of Easy Unicode Paster: http://easyunicodepaster.wikidot.com

wreckedcarzz

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 1,626
    • View Profile
    • Donate to Member
Re: Help! Visual Basic is stealing my objects and giving me errors!
« Reply #2 on: September 06, 2008, 01:23 AM »
It is all in the same .vb file

I didn't copy ANY code from the designer.vb files - I never tinker with them, don't care what is in them, let Visual Studio handle that.

I did LOOK in the designer.vb file and I believe it does have that entry, but I did not put it there...

I'm confused as to how it seemingly randomly happens too... :o