Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Dec 4th, 2005, 4:09 AM   #1
pallytruck
Newbie
 
Join Date: Dec 2005
Posts: 2
Rep Power: 0 pallytruck is on a distinguished road
Problem with access and vb

Right thought this would be a simple task i am so frustated. Basically i have a database with pictures. i understand basic vb and access but never tried this before and thought it would be simple when i load the form instead of the picture being in a picture box it is a jpeg or bmp icon which you click on and it loads up in a photo application say paint. What's the point in that? I want the pictues on the form. Tried everything including package settings but that won't even let me change view to picture. Is there some code i can put in and where would i put it so that it ativates when the form loads and when records are changed.
Help would be very very helpful i will email a copy of my game when it is finished as well if you can provide the answer
pallytruck is offline   Reply With Quote
Old Dec 4th, 2005, 4:32 AM   #2
Polyphemus_
Expert Programmer
 
Polyphemus_'s Avatar
 
Join Date: Aug 2005
Location: Rotterdam, the Netherlands
Posts: 942
Rep Power: 4 Polyphemus_ is on a distinguished road
What version of VB are you using?
Polyphemus_ is offline   Reply With Quote
Old Dec 4th, 2005, 4:53 AM   #3
lectricpharaoh
Caffeinated Neural Net
 
lectricpharaoh's Avatar
 
Join Date: Jun 2005
Location: Dry west coast of Canada
Posts: 1,033
Rep Power: 5 lectricpharaoh will become famous soon enough
Quote:
Originally Posted by pallytruck
Right thought this would be a simple task i am so frustated. Basically i have a database with pictures. i understand basic vb and access but never tried this before and thought it would be simple when i load the form instead of the picture being in a picture box it is a jpeg or bmp icon which you click on and it loads up in a photo application say paint. What's the point in that? I want the pictues on the form. Tried everything including package settings but that won't even let me change view to picture. Is there some code i can put in and where would i put it so that it ativates when the form loads and when records are changed.
Help would be very very helpful i will email a copy of my game when it is finished as well if you can provide the answer
How are you storing the picture in the database? I assume you mean the database stores the file name; in this case, it should be easy to do. Code below is actually VB.NET; I've never used any other version of VB, so I don't know if it's the same as VB6.
' assumes fileName is a string with the bitmap's filename in it, and picBox
' is a PictureBox control.
 
Dim isValid As Boolean = True
Dim itemImage As Bitmap
Try
  itemImage = New Bitmap(fileName)
Catch ex As Exception
  isValid = False
End Try
If isValid Then
  picPreview.Image = itemImage
Else
  picPreview.Image = Nothing
End If
__________________
And once again, Probability proves itself willing to sneak into a back alley and service Drama as would a copper-piece harlot.
- Vaarsuvius, Order of the Stick
lectricpharaoh is offline   Reply With Quote
Old Dec 4th, 2005, 8:15 AM   #4
pallytruck
Newbie
 
Join Date: Dec 2005
Posts: 2
Rep Power: 0 pallytruck is on a distinguished road
hi thanks for your help unfortunlty it came up with syntax error when i coded it in also i am using a jpeg file not a bitmap does that make any difference?
pallytruck is offline   Reply With Quote
Old Dec 4th, 2005, 8:49 AM   #5
lectricpharaoh
Caffeinated Neural Net
 
lectricpharaoh's Avatar
 
Join Date: Jun 2005
Location: Dry west coast of Canada
Posts: 1,033
Rep Power: 5 lectricpharaoh will become famous soon enough
Quote:
Originally Posted by pallytruck
hi thanks for your help unfortunlty it came up with syntax error when i coded it in also i am using a jpeg file not a bitmap does that make any difference?
Not in VB.NET; dunno about VB6.

What was the error?
__________________
And once again, Probability proves itself willing to sneak into a back alley and service Drama as would a copper-piece harlot.
- Vaarsuvius, Order of the Stick
lectricpharaoh is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 7:47 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC