-
Apr 25th, 2012, 06:17 AM
#1
Thread Starter
PowerPoster
[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)
Last edited by joaquim; Apr 25th, 2012 at 06:21 AM.
-
Apr 25th, 2012, 06:25 AM
#2
Thread Starter
PowerPoster
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
-
Apr 26th, 2012, 01:56 PM
#3
Thread Starter
PowerPoster
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?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|