Results 1 to 6 of 6

Thread: [RESOLVED] Label Resize Error ,Please Help !

  1. #1

    Thread Starter
    Hyperactive Member nUflAvOrS's Avatar
    Join Date
    Jul 2007
    Location
    Malaysia/ Currently at Singapore
    Posts
    372

    Resolved [RESOLVED] Label Resize Error ,Please Help !

    I would like to resize the label when the form is resized.
    But an error pop up 'Invalid call of arguement'
    What the problem of my code ?

    VB Code:
    1. Private Sub Form_Resize()
    2. Dim ctrl As Control
    3.  
    4.     For Each ctrl In Me.Controls
    5.         If TypeOf ctrl Is Label Then
    6.             ctrl.Move ctrl.left, ctrl.tOp, _
    7.             Me.ScaleWidth - ctrl.left * 2, _
    8.             Me.ScaleHeight - ctrl.tOp - ctrl.left
    9.         End If
    10.     Next      
    11. End Sub

    Thanks for help
    Where there is no hope, there can be no endeavor.

    There are two ways of rising in the world, either by your own industry or by the folly of others.

  2. #2
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Label Resize Error ,Please Help !

    When you get the error again, copy line #7 & #8 to your debug/immediate window and and print the result... ? Me.ScaleHeight - ctrl.top - ctrl.left

    You will probably find you are trying to set values outside what is valid (negative width or height)

  3. #3

    Thread Starter
    Hyperactive Member nUflAvOrS's Avatar
    Join Date
    Jul 2007
    Location
    Malaysia/ Currently at Singapore
    Posts
    372

    Re: Label Resize Error ,Please Help !

    Yes absolutely true, I get the negative value of width and height ...
    I will try modify to code ... thanks


    Lavolpe

    I saw your imaglist code became contest winner in planet source code..
    Congraturation !!
    Where there is no hope, there can be no endeavor.

    There are two ways of rising in the world, either by your own industry or by the folly of others.

  4. #4
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Label Resize Error ,Please Help !

    You're welcome and thanx for the congrats. In the process of rewriting it now for a "final" release in a week or two; just to get it done & out of the way -- have many more projects on my plate.

  5. #5
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: [RESOLVED] Label Resize Error ,Please Help !

    Oh, one more piece of advice before I log off for the night.
    In your resize event, always check if Me.WindowState=vbMinimized and then exit sub if it's true. Reszing when minimized generates errors too.

  6. #6

    Thread Starter
    Hyperactive Member nUflAvOrS's Avatar
    Join Date
    Jul 2007
    Location
    Malaysia/ Currently at Singapore
    Posts
    372

    Re: [RESOLVED] Label Resize Error ,Please Help !

    Ok thanks LaVolpe,I will take note for what you have been mentioned
    Good Night and Sweet Dream.
    Where there is no hope, there can be no endeavor.

    There are two ways of rising in the world, either by your own industry or by the folly of others.

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