Question How do I display Pictures

Iron23

Member
Joined
Jun 17, 2008
Messages
22
Programming Experience
Beginner
Here is the Image of what It should look like, when Selecting it will show the pic nd the two boxes.


Unfortunately It look like this when i debug. (ps. This is only a sample. My real project is on a different subject.)


So how can I make it so that when An item Is selected it shows the text, and the pictures?????????????????
 
APPLIES TO
• Microsoft ADO.NET (included with the .NET Framework)
• Microsoft ADO.NET 1.1
• Microsoft Visual Basic .NET 2002 Standard Edition
• Microsoft Visual Basic .NET 2003 Standard Edition
----------
Could that be an issue?
 
Yes. unless there is another way to do it without affecting the other text tables it is currently using from the database
 
by "text tables" do you mean multi-line textbox? I was asking about database, due to possible homework assignment. I did a project similar to this using a text file it uses a picbox, a combobox, 4 labels and a multiline textbox here are a couple of screenshots of the program the first is the program first starts and the second is when a selection is selected.
pgmstart.jpg

pgmrun.jpg


the best part of using a text file in this scenario is, I don't have to worry about having to package a database in deployment.

if this isn't what you are looking for, sorry.

Good luck
unimac
 
Yes that is almost exactly what I am trying to do.

How do you get the picture to display? I have the picture in an access database and cannot get them to show?

Also how do I embed the data into the program. When I try and run the built application on a usb or another computer it wont work and says the database is missing.
 
is using a database a requirement?

database is missing.
bingo, we have a winner.

Database programming is great. trying to deploy one is horror. you usually have to do it with sql(whether it be mySQL, postgreSQL, or the like. meaning no access database) and have to include a sqlserver with your package.

That is why I try to stay away from them when necessary. This project is a good example when one is not needed.

Have you ever used StreamReader, StreamWriter from the IO class? The program I have also uses arrays.

Let me know,
unimac
 
here is what I want it to bassically look like. Might do some formatting on the final product.
http://img171.imageshack.us/my.php?image=newvbpic1ju8.jpg

Here is what it looks like, as you can see there are already some text boxes connected to the combobox
http://img59.imageshack.us/my.php?image=newvb2ry2.jpg

Here is what happens when I debug, try to change the combobox and then close the mypictures window it opens.
http://img514.imageshack.us/my.php?image=newvb3vm3.jpg

I only put these here from my post on another forums. Just incase they help. Its not my final GUI either, just a trial
 
Ive been here all day lol, and all yesterday, and the day before. Ill be on for another 6 hours. and some time tomorrow.

Is using this read and write thing something relatively simple and quick? If not thats ok. What ever I need to do to get my program basically exactly like yours except on a different topic.

Lol I must have refreshed this forum about 200 times now. And with the other forums in which the responses have been far off..
 
Last edited:
for some reason I don't remember this being in Data Access area and my post didn't get posted so here is another. First thing is set up a text file almost like you would a database.
For example, I have mine with the following:
  1. imagename.jpg
  2. president name
  3. spouse name
  4. place of birth
  5. age of inauguration
  6. number of terms
  7. date of birth
  8. date begin term
  9. date end term
this is done for each item and item in my case is president
then on to the programming part
set up arrays to hold each
set up streamreader
setup loop to read textfile

fill combobox with another loop

initialize labels, textbox with selected value from combobox

of course there is more to it than this, but this gives you an idea.

I have finished commenting the program I wrote for my son and added an About box. If you are like me and learn by example then this could help you.

unimac
 
Im sorry but im still learning most of VB, although that looks like what I want to do I don't understand how to do it.

Could you please explain how I would do it for me?
 
I'm not the best at explaining things, but I'll do the best I can.
First set up the text file that will hold all the data just like I showed in my last post. Then design your app.

Are you using a book, course or what to go by to learn VB.NET?

you are going to use arrays in this project. For example I have 9, (8 string, 1 integer)

VB.NET:
Private _strPicName(42) As String

I have 4 other variable also string used in storing filename of image, filename of text file, application path, and modified app path.

purpose of the app path is that no matter where you deploy it, it will be fine
VB.NET:
AppPath = My.Application.Info.DirectoryPath
In the Form_Load section
declare the following variables:
VB.NET:
Dim objReader as StreamReader
AppPath = My.Application.Info.DirectoryPath
two counters intCount, intFill and initialize both to zero
(I included a file not found error message, but isn't necessary for operation of program)
(put all pics, txt file in resources folder in solution explorer)

remember the application path and the modified app path variables declared earlier
VB.NET:
modifiedapppath = mid(appPath, 1, appPath.IndexOf("\bin\"))
we have to do this to take out \bin\ at end of path because we will be adding \Resources\and text file or image later

Next setup an If statement to check if text file exist.
If it doesn't we need to show an error message and close the app, otherwise, contine with a While statement to read the text file until no more can be read into the arrays and as with any loop don't forget the counter to prevent infinite loop.
When done with this loop close the SreamReader
VB.NET:
objReader.Close()
Next we need to do something with the data extracted from the text file
here I opted to start with filling the combobox with the presidents name
then from there things change from Form_Load to ComboBox1_SelectedIndexChanged event
in this event declare more variables
a selected variable for the selected item since each item is a number
this is an integer
also I have 4 message variables all string
initialize selected to combobox1.selectedIndex
setup if statement
since no president is selected in the beginning
VB.NET:
if intSelected greater than -1 
do the following 
this example 

initialize age label = age array (intSelected)

do this for each textbox, label or whatever control you are using
This should get you started

if any of this is seems confusing

you can start it and let me know how far you got, or tell me what you need help with and I'll try to explain it better.

unimac
 
Last edited:
Thanks alot. Can you quickly tell me if any of the code you mentioned needs me to substitute my things into it?

I'll have to try it later.

And how do I format the arrays in the text file.
 
Back
Top