Results 1 to 3 of 3

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

Threaded View

  1. #1

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

    [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.

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