Sion
Warrior
Denmark
138 Posts |
|
Eric Coleman
Gladiator
USA
811 Posts |
|
Sion
Warrior
Denmark
138 Posts |
Posted - Jul 09 2004 : 1:19:20 PM
|
Eric, that method sounds like the right one in this case. I've been looking at some of VB build-in function for something like this, but it's apparently undocumented (and therefore unsupported). However, I can't get it to work. I don't know what I'm doing wrong. I've made a small testing program - please take a look at it and see if you can spot any errors. Thanks for you quick and precise answer, by the way, and sorry I've taken so long to reply. The test program is attatched to this post.
Download Attachment: Control_Array_Test.zip 2 KB |
Visit my personal blog at www.AndersNissen.com! |
|
|
Sion
Warrior
Denmark
138 Posts |
Posted - Jul 09 2004 : 5:36:11 PM
|
Eric, can you tell me what I've done wrong, if anything? |
Visit my personal blog at www.AndersNissen.com! |
|
|
Eric Coleman
Gladiator
USA
811 Posts |
Posted - Jul 09 2004 : 5:39:08 PM
|
Hmm, looks like objPtr only works for classes.
I guess you'll just have to use a error check to find out if the control is loaded or not. The control array looks more like a collection than an array, and just like collections there is no way to test if an element exists or not.
I made some modifications to the program. There is a function that returns true or false depending on if the control is loaded or not. There is also some commented code that shows the first 400 bytes behind the ObjPtr value. You can compare the returned values before and after you remove a button, and one thing of note is that the "left" property value is clearly visible in the data, and the first 4 bytes change when the control is unloaded. I suppose the "unload" command doesn't really unload the control.
There's also a For Each loop that demonstrates a way to iterate through all the items as though it were a collection.
Download Attachment: Control_Array_Test.zip 2.5 KB |
|
|
Sion
Warrior
Denmark
138 Posts |
Posted - Jul 09 2004 : 5:48:44 PM
|
Ok, not quite the as elegant as I was hoping for, but hey - it get the job done. I don't suppose going through the internal error handling procedure slows down the process too much. I'll use the error handling method to perform the test - it seems like the only way. Well, anyway now I can get some coding done and get back to this issue if any new techniques surfaces. Thanks for taking the time to help me Eric! :) |
Visit my personal blog at www.AndersNissen.com! |
|
|
Sion
Warrior
Denmark
138 Posts |
|