Results 1 to 2 of 2

Thread: Dinamic Image Box

  1. #1

    Thread Starter
    Addicted Member Ramandeep's Avatar
    Join Date
    Feb 2000
    Posts
    158

    Unhappy Dinamic Image Box

    Can any one show me how I can add Image boxes to a imageBox control array dinamically (at run-time)?

    I already have one image boxe 'image1(0)' on the form and wish to add more but at run time useing code, can any one help?

    Or is there a way I can even add the first one at run time?

    Thanks in advance!

  2. #2
    Guest
    To add from a Control Array: Put the folowing code into a CommandButton. Every time you press it, it will load a new Image and position it underneath the previous one.

    Code:
    Private Sub Command1_Click()
    
        'Get the next Index
        I = Image1.Count
        'Load the Image
        Load Image1(I)
        'Move it underneath the last Image
        Image1(I).Move 0, Image1(I).Height * I
        'Make it Visible
        Image1(I).Visible = True
        
    End Sub

    To add them at Runtime, use this code, but it will only work with VB6.

    Code:
    Private Sub Command1_Click()
    
        Controls.Add "VB.Image", "Image1"
        Me!Image1.Move 0, 0
        Me!Image1.Picture = LoadPicture("C:\MyPicture.bmp")
        Me!Image1.Visible = True
    
    End Sub

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