473,382 Members | 1,225 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

picturebox in Listbox is lost

I add some picturebox in the listbox as controls like following.
Dim myPic as PictureBox
'Init myPic from here
'...
'...
for i=0 to 30
'New picturebox
'...
'set mypic property
'....
ListBox.Controls.Add(myPic)
next

When there is more PictureBox than the ListBox can display,
Vertical Scrollbar will appear. The problem is if user moves the
scrollbar up and down too fast, the picturebox in the ListBox will
disappear. Seems the controls in the listbox lost. Does anyone have
the same problem? How to solve it? Thanks!
Nov 21 '05 #1
2 3006
"Limin" <li*******@gmail.com> schrieb:
I add some picturebox in the listbox as controls like following.
Dim myPic as PictureBox
'Init myPic from here
'...
'...
for i=0 to 30
'New picturebox
'...
'set mypic property
'....
ListBox.Controls.Add(myPic)
next

When there is more PictureBox than the ListBox can display,
Vertical Scrollbar will appear. The problem is if user moves the
scrollbar up and down too fast, the picturebox in the ListBox will
disappear.


What's the reason for adding pictureboxes to a listbox? If you want to
associate images with the items of a list, use a listview control instead of
the listbox control, or write an ownerdrawn listbox control that paints the
images into the items.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #2
Thanks for your reply, Mr. Wagner.

The reason I want to add picturebox to listbox not listview is I
dynamically create picturebox, but the picturebox does not have image
information, I only use picturbox's backcolor to display different
colors. The listbox contains both text(Department Name) and color(Legend
bar for Department Name), it works fine only except if scrollbar moves
fast it will lose the picturebox.

But with listview, I need to add smallimagelist which created from ICONS
or BMPFILE, but I don't have image info. for that.

Thanks again for you help. Happy New Year!

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Bent F | last post by:
Going from VB6 to VB.NET i have lost the capability to do the most simple things... In VB6 scaling a picturebox was done like this: Me.picturebox.scale (0,25)-(25,0) How is it done in...
3
by: Andrew | last post by:
I'm having a major problem with a databound listbox in C#. In the constructor for the form I am trying to pre-select some of the items based in information in the database. When I step through the...
6
by: Janaka | last post by:
Help! I have two ListBox controls on my web form. The first one gets populated on entry with values from the DB. I then use JavaScript to copy options from this ListBox to my second one. (I...
3
by: touf | last post by:
Hi, I've a Tabcontrol with many tabpages, in each one I've a checked listBox. The problem is that when I check items in listBox and go to an other page I lost the check (when i return to my...
2
by: kalp suth via DotNetMonster.com | last post by:
I want to create arrows using lines on a picture in the picture box. On clicking the button "btnShowAll", the image is loaded and the lines drawn. "RGSShowAll()" calls "DrawObjs()" which does the...
1
by: Bob | last post by:
Boy, Do I feel dumb. I created an Image for a picture box control which is currently in use and I can't find the source file. If I click on the image property ellipis it opens on the last...
0
by: Brahm | last post by:
Going from VB6 to VB.NET i have lost the capability to do the most simple things... In VB6 scaling a picturebox was done like this: Me.picturebox.scale (0,25)-(25,0) How is it done in VB.NET...
4
by: Bart Steur | last post by:
Hi, I'm writing an app to maintain products. The products are listed in a listbox and when I click a product in a listbox some info of that product is shown including a picture of the product. ...
6
by: kucheravy | last post by:
Hi, everybody. I have this problem. When I put a <asp:ListBox on a web page and populate the data in the page Page_Load event the ViewState for the control is saved and loaded (after postback)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.