|
#1
|
|||
|
|||
|
Runtime Error 340
Hi, I have a program where I am creating several controls at runtime using the control array method. So I have a Shape with it's index set to zero, and at the click of a button I create a new control with the load statement and it gets placed on the form with an index of 1 and so on. However, everytime I do this, when I unload the form I get this error:
Runtime Error 340: Control array element '1' doesn't exist Do I have to manually unload all the created controls? Any ideas what this could mean? |
|
#2
|
||||
|
||||
|
Do you have some code in the Unload or QueryUnload events?
Marco |
|
#3
|
|||
|
|||
|
Nothing that has anything to to do with the newly created controls, should there be?
|
|
#4
|
||||
|
||||
|
well, I was wondering if there was code that was causing the error. Do you get the problem in the IDE? Can you debug and trace where the error is?
Marco |
|
#5
|
|||
|
|||
|
Actually I found what the problem was. I was passing the controls to certain custom made classes, when the form was unloaded the controls would unload, and then the classes would unload. In the class I was also trying to unload the passed control (which was already unloaded from the form) and hence, my error.
Thanks!! |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|