I have a button, if I press the button, new picturebox will appear in my main form.
How to add picturebox name in the listbox ?
how to select picturebox name from a listbox for deleting the selected picturebox?

thanks...

Recommended Answers

All 5 Replies

I have a button, if I press the button, new picturebox will appear in my main form.
How to add picturebox name in the listbox ?
how to select picturebox name from a listbox for deleting the selected picturebox?

thanks...

C#
The picture box has a name. Something like picturebox1.name .
Then simply make something like listbox.items.add(picturebox1.name).

THere should be something similar for VP.net . Look on MS sites for properties for listbox. There are always examples also for the vb, c++ and c#.

now I can adding items in the list box.. thanks to Seten...

i'm still dont get any idea how to select picturebox I create form a list box. all i can do is select the last created picturebox.

Try
            'if the name of the picturebox is added into the listbox
            Dim picBox As PictureBox = CType(Me.Controls.Find(ListBox1.SelectedItem.ToString, True)(0), PictureBox)
            picBox.Select()
        Catch ex As Exception
            'picturebox not found
        End Try

where should I write the code ? in SelectedIndexChange ?

yes

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.