dcsimg
Results 1 to 3 of 3

Thread: [RESOLVED] How to instantiate and use a PictureBox at runtime?

Hybrid View

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2007
    Posts
    2

    Resolved [RESOLVED] How to instantiate and use a PictureBox at runtime?

    Hi all. In VB6, I've been trying to create an array of PictureBoxes that I can print things to while my program is running, but the New keyword gives me an error. Could anyone be able to explain how to create PictureBoxes at runtime that I can draw things to?

  2. #2
    Super Moderator Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,335

    Re: How to instantiate and use a PictureBox at runtime?

    Welcome to the forums.

    Something like
    Code:
    Private Sub Command1_Click()
    Dim pctPictureBox As PictureBox
    Set pctPictureBox = Me.Controls.Add("VB.PictureBox", "pctPictureBox" & Me.Controls.Count)
    pctPictureBox.Visible = True
    End Sub
    Please use [Code]your code goes in here[/Code] tags when posting code.
    When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    I dont answer coding questions via PM or EMail. Please post a thread in the appropriate forum section.

    Creating A Wizard In VB.NET
    Paging A Recordset
    What is wrong with using On Error Resume Next
    Good Article: Language Enhancements In Visual Basic 2010
    Upgrading VB6 Code To VB.NET
    Microsoft MVP 2005/2006/2007/2008/2009/2010/2011/2012/Defrocked

  3. #3

    Thread Starter
    New Member
    Join Date
    Jul 2007
    Posts
    2

    Re: How to instantiate and use a PictureBox at runtime?

    Awesome! Thanks!

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width