|
-
Feb 27th, 2010, 01:02 AM
#1
Thread Starter
Addicted Member
Do i need a database, or alternative?
Hi all, im extremely new to coding so im sorry if some of my questions sound basic etc.
Im currently developing an app, in which there is a list box which will contain between 200 and 3000 items. These items are loaded into the list box from a .txt file. Now on the same form i have
Picture boxes x 6
Textboxes x 5
The contents of which changes with each list item selected, and to do this i have the code attached to the list box, heres a snippet of the code:
Code:
If (listbox1.SelectedItem = "3 Ninjas Kick Back") Then
pboxGameCover.ImageLocation = System.IO.Directory.GetCurrentDirectory() & "\pics\" & "1.jpg"
pboxGameCoverA.ImageLocation = System.IO.Directory.GetCurrentDirectory() & "\pics\" & "1a.jpg"
s1.ImageLocation = System.IO.Directory.GetCurrentDirectory() & "\pics\" & "1b.jpg"
s2.ImageLocation = System.IO.Directory.GetCurrentDirectory() & "\pics\" & "1c.jpg"
s3.ImageLocation = System.IO.Directory.GetCurrentDirectory() & "\pics\" & "1d.jpg"
s4.ImageLocation = System.IO.Directory.GetCurrentDirectory() & "\pics\" & "1e.jpg"
regioncode.Text = "T-46029"
date2.Text = "-"
name2.Text = "N/A"
name1.Text = "N/A"
name3.Text = "N/A"
genre.Text = "Action"
ElseIf (listbox1.SelectedItem = "A-Rank Thunder Tanjouhen") Then
pboxGameCover.ImageLocation = System.IO.Directory.GetCurrentDirectory() & "\pics\" & "2.jpg"
pboxGameCoverA.ImageLocation = System.IO.Directory.GetCurrentDirectory() & "\pics\" & "2a.jpg"
s1.ImageLocation = System.IO.Directory.GetCurrentDirectory() & "\pics\" & "2b.jpg"
s2.ImageLocation = System.IO.Directory.GetCurrentDirectory() & "\pics\" & "2c.jpg"
s3.ImageLocation = System.IO.Directory.GetCurrentDirectory() & "\pics\" & "2d.jpg"
s4.ImageLocation = System.IO.Directory.GetCurrentDirectory() & "\pics\" & "2e.jpg"
regioncode.Text = "T-48084"
date2.Text = "06/25/93"
name2.Text = "N/A"
name1.Text = "N/A"
name3.Text = "N/A"
genre.Text = "Adventure"
This works great, but at the moment with 178 items on the list the total code is pretty big, and i get the feeling it would run faster if loaded dynamically.
Am i right in thinking that? Especially when the list has 3000 items, thats alot of code to have attached to a listbox.
And how do i go about making the code dynamic, im looking round the forum and seeing ADO database mentioned alot and that seems to be the answer at least for the text fields, would that also work for the picture box fields? And is the a good guide for total beginners for using that around here?
Thanks for any help you can give me!
DragonRose.
Last edited by MartinLiss; Feb 27th, 2010 at 12:15 PM.
-
Feb 27th, 2010, 12:16 PM
#2
Re: Do i need a database, or alternative?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|