thanks my friend
i will see it in weekend. thanks
Printable View
thanks my friend
i will see it in weekend. thanks
i know programming but sometimes(in these case in VB6), when i program, some strange things appens:(
like some code is working now, then(without change) isn't....
honestly i don't understand:(
because now i have some problems in my Sprite control:(
can you spend some time with me for resolve them?
(if you can use messenger/msn greate, if not that's ok)
thanks
You can always go back to your old code, when it was working right
yeah, thanks for the advice.
i need ask you something...
in UC, i need activate a API functions(like message windows(winproc()), but i don't know what event must use. because the initializate event is only for change the variables(i can't use it for more)... i could use the show event, but the show event is call it when it's created(with or without image/backcolor)?
i know i thing, the terminate event is called when the UC is created... why? can i ignore it(when is created)?
thanks
I don't understand the question
i'm sorry i will say in other words...
when the UC is created, why the Finalizate event is called? these event can be ignored when the UC is created?
anotherthing when the UC is created the Initializated event is called, but i only can change the variables values.... when the UC is created(Visible can or not be true, doesn't mine), the Show event is always called?
thanks
ok.. now i can continue with our conversation;)
i need build an Destroy method(i don't care if the object was created in Load function or in project-mode). can you advice me?
or give me informations?
thanks
Objects which are created at design-time cannot be destroyed at runtime. However, if you create an array, then additional elements can be loaded and unloaded at runtime. Still, the one you created at design-time must remain.
In the case of your sprites, one could be placed on the form at design-time, with an Index of zero. The other sprites would then be loaded/unloaded at runtime.
<EDIT>
Additionally, a UserControl cannot unload itself. The controls should be loaded and unloaded by the program in which they are used.
Simply place one object on the form, and set the Index property to zero. This will create an array.
Then at runtime:You can create the first element with an Index other than zero, if you want. Note also that elements can be unloaded in any order. So the UBound of the array will not be the same as the Count. In other words, if you have 5 elements (Indexes of 1 to 5), and you unload number 2, the UBound will still be 5, while the Count is 4. This means that you may encounter errors if you try to iterate through an array after unloading one or more elements where the Index is not the UBound.Code:Private Sub CreateSprite(X As Long, Y As Long, Color As Long)
Dim I As Long
I = MySpriteArray.UBound + 1
Load MySpriteArray(I)
MySpriteArray.Move X, Y
MySpriteArray.ForeColor = Color
MySpriteArray.Visible = True
End Sub
Private Sub KillSprite(Index As Long)
Unload MySpriteArray(Index)
End Sub
Objects can be created at runtime without being part of an array, but in that case you will not be able to catch the events without subclassing, which will very likely bring you many headaches.