Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 2005 > Visual Basic 2005 Basics
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Visual Basic 2005 Basics If you are new to Visual Basic programming with version 2005, this is the place to start your questions. For questions about the book: Beginning Visual Basic 2005 by Thearon Willis and Bryan Newsome, ISBN: 0-7645-7401-9 please, use this forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Basic 2005 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old August 30th, 2010, 08:18 PM
Registered User
 
Join Date: Aug 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Combobox binding 2000 pictures

I'm really stuck here. I need a combobox to display 2000 pictures and when I click on any picture, it should display in a picture box. Here's my code but its not working..

Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Picbox.BackgroundImageLayout = ImageLayout.Zoom

For index As Integer = 1 To 2000
cmb.Items.Add(index)
Next


End Sub


Please help me out ASAP. Thanks!
Reply With Quote
  #2 (permalink)  
Old August 30th, 2010, 09:28 PM
Friend of Wrox
Points: 3,060, Level: 23
Points: 3,060, Level: 23 Points: 3,060, Level: 23 Points: 3,060, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2005
Location: , , .
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

Hi

your current code loads the Combobox with values

You need to write the code for selecting and showing the picture in Combobox's Click or Change event

Cheers
Shasur
__________________
C# Code Snippets (http://www.dotnetdud.blogspot.com)

VBA Tips & Tricks (http://www.vbadud.blogspot.com)
Reply With Quote
  #3 (permalink)  
Old August 30th, 2010, 09:44 PM
Registered User
 
Join Date: Aug 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi thanks for the reply. But now I'm confused how do I write the code for selecting and showing the picture?

Last edited by Mazz; August 30th, 2010 at 09:51 PM.
Reply With Quote
  #4 (permalink)  
Old August 31st, 2010, 08:46 AM
Friend of Wrox
Points: 1,075, Level: 12
Points: 1,075, Level: 12 Points: 1,075, Level: 12 Points: 1,075, Level: 12
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2005
Location: , , United Kingdom.
Posts: 244
Thanks: 3
Thanked 4 Times in 4 Posts
Default

If you look at your code more closely, your firing the "Form Load Event"

But your saying you want to display the picture when an item is clicked. Thus stating that you want to fire the "Combo Box Click Event".

Your current code ONLY handles the form load event, you need your code to handle the combo box click event. So in your form design view, double click the combo box and it'll bring up the code view and create a new sub routine handling said event.

It'll be something like this:
Code:
Private Sub cmb_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmb.Click

'select the image to display corresponding to the index selected

End Sub
Okay?
__________________
Apocolypse2005, I'm a programmer - of sorts.
Reply With Quote
  #5 (permalink)  
Old August 31st, 2010, 09:23 PM
Registered User
 
Join Date: Aug 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi, thanks for your reply however when i tried it, and whenever im clicking on the drop down menu of the combo box it kept on increasing twice. Can you let me a sample of the code how it'll be please?
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
binding combobox to textbox cancertropica WinForms/Console Application Design 2 July 27th, 2009 01:21 PM
Save Pictures in MS SQL Server 2000 kudzuconf SQL Server 2000 1 March 15th, 2006 10:10 AM
Issue Binding to ComboBox. lam_lvl VB.NET 2002/2003 Basics 1 February 22nd, 2006 08:38 PM
binding combobox to sqlreader? drachx General .NET 6 October 14th, 2004 07:10 PM
ComboBox Data Binding bmains VB.NET 0 October 5th, 2004 02:35 PM



All times are GMT -4. The time now is 12:12 PM.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.