Results 1 to 6 of 6

Thread: [RESOLVED] Creating an image box

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2007
    Posts
    4

    [RESOLVED] Creating an image box

    Is there anyway to create an image box during runtime through a button or code?

    Either a no or explanation would be very useful.
    Thanks in advance.

    Odracir123.
    Last edited by Odracir123; Jun 26th, 2007 at 11:24 AM. Reason: resolved

  2. #2
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Creating an image box

    There two ways (only) to create new control ar runtime in VB6:

    - using control array (group of controls sharing the same name but having unique indexes)
    - using Controls collection

    Method 1: control array:

    - create one image control in design mode and change its Index property to 0 (zero)
    during runtime use similar code (button click lot form_load or whatever):
    Code:
    Load Image1(Image1.Ubound +1)
    Image1(Image1.Ubound).Move SomeLeft, someTop
    Set Image1(Image1.Ubound).Picture = LoadPicture("full path goes here")
    Image1(Image1.Ubound).Visible = True
    Method 2 - controls collection:
    Code:
    Dim img As Image
    
    Set img = Me.Controls.Add("VB.Image", "imgNew")
    Set img.Picture = LoadPicture("full path goes here")
    img.Move SomeLeft, someTop
    img.Visible = True

  3. #3
    Fanatic Member vivek_master146's Avatar
    Join Date
    Apr 2006
    Location
    Delhi,India
    Posts
    787

    Re: Creating an image box

    Dont rely only on your luck. Work hard until You get success.
    vb Code:
    1. Private sub Time_ispassing
    2. While Me.Notgetsuccess
    3. trygain=tryagain+1
    4. Me.workhard
    5. wend
    6. end sub

  4. #4
    Fanatic Member vivek_master146's Avatar
    Join Date
    Apr 2006
    Location
    Delhi,India
    Posts
    787

    Re: Creating an image box

    Hey rhinbobull the link i posted is same what u wrote. it was also posted by u.
    Dont rely only on your luck. Work hard until You get success.
    vb Code:
    1. Private sub Time_ispassing
    2. While Me.Notgetsuccess
    3. trygain=tryagain+1
    4. Me.workhard
    5. wend
    6. end sub

  5. #5

    Thread Starter
    New Member
    Join Date
    Jun 2007
    Posts
    4

    Re: Creating an image box

    Thank you so much. You have no idea how long I've been looking for this.

    Thanks again, Odracir123.

  6. #6

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