[VB6] - using a string control name for catch it's properties
i use these code for catch the Top and Left of a control string Name(in a property):
Code:
lngOldScrollObjectY = UserControl.Parent.Controls(strObjectScroll).Top
lngOldScrollObjectX = UserControl.Parent.Controls(strObjectScroll).Left
what is strange is that i get an error message:
"728 - is not legal control name"
and these property activate 1 timer. and in a timer i have these that don't gives me an error:
Code:
If UserControl.Parent.Controls(strObjectScroll).Top > lngOldScrollObjectY Then
ScrollingVertical.Value = ScrollingVertical.Value + UserControl.Parent.Controls(strObjectScroll).Top + lngOldScrollObjectY
lngOldScrollObjectY = UserControl.Parent.Controls(strObjectScroll).Top
ElseIf UserControl.Parent.Controls(strObjectScroll).Top < lngOldScrollObjectY Then
ScrollingVertical.Value = ScrollingVertical.Value - UserControl.Parent.Controls(strObjectScroll).Top - lngOldScrollObjectY
lngOldScrollObjectY = UserControl.Parent.Controls(strObjectScroll).Top
ElseIf UserControl.Parent.Controls(strObjectScroll).Left > lngOldScrollObjectX Then
ScrollingVertical.Value = UserControl.Parent.Controls(strObjectScroll).Left - lngOldScrollObjectX
lngOldScrollObjectX = UserControl.Parent.Controls(strObjectScroll).Left
ElseIf UserControl.Parent.Controls(strObjectScroll).Left < lngOldScrollObjectX Then
ScrollingVertical.Value = UserControl.Parent.Controls(strObjectScroll).Left + lngOldScrollObjectX
lngOldScrollObjectX = UserControl.Parent.Controls(strObjectScroll).Left
End If
that's strange. how can i avoid that error?
(these usercontrol is a container and these string control name is a control name that is inside of usercontrol)
Re: [VB6] - using a string control name for catch it's properties
i think that in property the string is empty and in timer isn't. maybe is about property order problem. please tell me something:(
Re: [VB6] - using a string control name for catch it's properties
i thot well;)
the property order is important, but i don't know how the usercontrol can read it's properties(when is initializated).
but doing these if:
Code:
If strObjectScroll <> Empty Then
lngOldScrollObjectY = UserControl.Parent.Controls(strObjectScroll).Top
lngOldScrollObjectX = UserControl.Parent.Controls(strObjectScroll).Left
End If
and put the same if when the usercontrol is showed, and the problem goes away;)
can anyone tell me how the usercontrol read it's properties, when it's initializaded?