Results 1 to 3 of 3

Thread: [VB6] - using a string control name for catch it's properties

  1. #1

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,904

    [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.
    VB6 2D Sprite control

    To live is difficult, but we do it.

  2. #2

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,904

    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
    VB6 2D Sprite control

    To live is difficult, but we do it.

  3. #3

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,904

    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?
    VB6 2D Sprite control

    To live is difficult, but we do it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width