moongodess Posted June 16, 2005 Posted June 16, 2005 I have a project with many user controls. What I need to do is insert some of them in a form. For some reason I can't insert one of them :( It gaves me an error (attached) What am I doing wrong??error.bmp Quote
Moderators Robby Posted June 16, 2005 Moderators Posted June 16, 2005 When declaring the control are you using the keyword 'new' ? Quote Visit...Bassic Software
Leaders snarfblam Posted June 16, 2005 Leaders Posted June 16, 2005 This is happening in the designer when you drag it out from the toolbox? It sounds like an error is occuring inside the control. Is it .Net? VB6 ActiveX? If it is something of your creation, you might want the control's source code for errors or debug it. If not, you might want to check and ensure compatability. Quote [sIGPIC]e[/sIGPIC]
moongodess Posted June 17, 2005 Author Posted June 17, 2005 Yes marble_eater, this is happening when I drag it out from the toolbox :( My project is a 'simple' windows application (in vb.net) with some forms and user controls. What I don't understand is why do I get an error with just one of the user controls. The others are ok. All of them have the same properties, what changes is the controls in them.. Quote
Administrators PlausiblyDamp Posted June 17, 2005 Administrators Posted June 17, 2005 Is the control one written in house or developed by a third party? Also is the control a .Net control or an ActiveX control you are using under .Net? If it is a 3rd party control try re-installing it and see if that fixes the problem - if an inhouse control check there haven't been any breaking changes made to it recently. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
moongodess Posted June 17, 2005 Author Posted June 17, 2005 I made that user control inside my project.. Quote
jmcilhinney Posted June 17, 2005 Posted June 17, 2005 I think you can put MessageBox.Show into the constructor code of your control and they will be displayed when you create an instance in the designer. This will tell you where you are in your code and should help you narrow down where the error is coming from. Quote
IngisKahn Posted June 17, 2005 Posted June 17, 2005 Repent from your old VB6 ways! Use Debug.WriteLine instead. :) Quote "Who is John Galt?"
Machaira Posted June 17, 2005 Posted June 17, 2005 Looks like you have something in the control that isn't being created. What the code in the control's constructor or Load event look like? Quote Here's what I'm up to.
Leaders snarfblam Posted June 17, 2005 Leaders Posted June 17, 2005 Repent from your old VB6 ways! Use Debug.WriteLine instead. :) Besides the fact message boxes aren't really the VB6 way (we did have Debug.Print in VB6, no?), MessageBox can be better; it pauses execution and you are certain to see the information, and you can break execution if the data doesn't seem right. Of course, it also requires removal or conditional compilation, and most of what you can do with a messagebox can also be done with breakpoints. Ultimately a matter of preference, I suppose. Quote [sIGPIC]e[/sIGPIC]
moongodess Posted June 17, 2005 Author Posted June 17, 2005 Looks like you have something in the control that isn't being created. What the code in the control's constructor or Load event look like? :confused: I have nothing in load event.. I've created a LoadValues procedure to prevent that from happening. That procedure is called only when the form (wich contain the control) displays. I think you can put MessageBox.Show into the constructor code of your control and they will be displayed when you create an instance in the designer. This will tell you where you are in your code and should help you narrow down where the error is coming from.[/Quote] I put messageboxes in new and initialize procedures, and I still couldn't see where the error is, because it is the first message I see.. No description, nothing.. Quote
IngisKahn Posted June 17, 2005 Posted June 17, 2005 Besides the fact message boxes aren't really the VB6 way (we did have Debug.Print in VB6' date=' no?), MessageBox can be better; it pauses execution and you are certain to see the information, and you can break execution if the data doesn't seem right. Of course, it also requires removal or conditional compilation, and most of what you can do with a messagebox can also be done with breakpoints. Ultimately a matter of preference, I suppose.[/quote'] That makes sense. The point being: know what tools you have available. (Thou a break point is always > a message box IMO) I made the VB6 comment because few are the MFC prorammers who debug using AfxMessageBox. :) Quote "Who is John Galt?"
Leaders snarfblam Posted June 17, 2005 Leaders Posted June 17, 2005 The fact of the matter is that we really don't know what is going on inside of your control and it is hard to give advice. The best one can do is tell you that you are trying to use an object you haven't created. The control probably tries to access something that isn't created until LoadValues is called. Check you're Resize event handlers, Invalidate event handlers, etc. to see if they access an object that wouldn't be initialized at design time (since the LoadValues function probably won't get called at design time). Check any initialization code that will be called at design time. Throw in some message boxes, or debug output or something. Quote [sIGPIC]e[/sIGPIC]
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.