Chat LIVE With Programming Experts! There Are 23 Online Right Now...

Welcome to Dream.In.Code
Become a VB Expert!

Join 244,310 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 861 people online right now. Registration is fast and FREE... Join Now!




how to make a picturebox during runtime

 
Reply to this topicStart new topic

how to make a picturebox during runtime, make something during runtime, help help! ^_^

qw123456
27 Nov, 2008 - 01:40 AM
Post #1

New D.I.C Head
*

Joined: 27 Nov, 2008
Posts: 1

I want to make many pictureboxes, label during runtime.
If i double click it, then a picturebox will appear in my form.
How to do that?
Can you help me, pleaseee

And one more question, if my picturebox has already so many, will it become blinking or not?

Here is my code, i am confusing
CODE

Public Class Form1
    Dim mapX, mapY As Integer
    Dim bb As New PictureBox
    Dim aLabel As New Label
    Private Sub Form1_MouseDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDoubleClick
        Dim a As New PictureBox
        a.Image = Image.FromFile("Salpa aspera.jpg")
        a.Location = Control.MousePosition
        a.Width = 100
        a.Height = 100
        Me.Refresh()
        bb = a

        aLabel.Text = "fdsfdsa"
        aLabel.Location = Control.MousePosition
        MsgBox(Control.MousePosition.ToString)
        aLabel.Visible = True
        l1.Location = Control.MousePosition

    End Sub
....




User is offlineProfile CardPM
+Quote Post


thava
RE: How To Make A Picturebox During Runtime
27 Nov, 2008 - 03:49 AM
Post #2

D.I.C Addict
Group Icon

Joined: 17 Apr, 2007
Posts: 670



Thanked: 35 times
Dream Kudos: 75
My Contributions
just make some small changes

you need to add the controls to the form or other containers
vb


Private Sub Form1_MouseDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDoubleClick
Dim a As New PictureBox
Dim alabel As New Label
'a.Image = Image.FromFile("Salpa aspera.jpg")
a.Location = e.Location
a.Width = 10
a.Height = 10

Me.Refresh()


aLabel.Text = "fdsfdsa"
aLabel.Location = Control.MousePosition
MsgBox(e.Location.ToString)
aLabel.Visible = True
alabel.Top = e.Y
alabel.Left = e.X + a.Width
Me.Controls.Add(a)
Me.Controls.Add(alabel)
End Sub


User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 7/4/09 07:18PM

Live VB Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month