| | |
how to dislay alternate image
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Aug 2008
Posts: 8
Reputation:
Solved Threads: 0
this is my first project n i need help in displaying images in imagebox
this is the code to display the code which i am using to display images in imagebox
Image1.Picture = LoadPicture("C:\images\" & Text3.Text & ".jpg") '<<this works fine>>
in the above code the location is C:\images\ , the file name will be the value of text3
but in case if the image with the filename<<value of text 3>> is nt found in C:\images\
i want to display an alternate image whose name is "mypic" and is located in C:\images\
what should be the code??
plz help ASAP
this is the code to display the code which i am using to display images in imagebox
Image1.Picture = LoadPicture("C:\images\" & Text3.Text & ".jpg") '<<this works fine>>
in the above code the location is C:\images\ , the file name will be the value of text3
but in case if the image with the filename<<value of text 3>> is nt found in C:\images\
i want to display an alternate image whose name is "mypic" and is located in C:\images\
what should be the code??
plz help ASAP
•
•
Join Date: Aug 2008
Posts: 1,162
Reputation:
Solved Threads: 137
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Dim basePath as String Dim filename as String Dim ext as String ext = ".jpg" basePath = "C:\Images\" filename = Text3.Text filename = filename & ext Dim oFile As New Scripting.FileSystemObject FileExists = oFile.FileExists(basePath & filename + ext) If(!FileExists) filename = "mypic" + ext End If Image1.Picture = LoadPicture(basepath & filename)
Custom Application & Software Development
www.houseshark.net
www.houseshark.net
I'm not sure but ...
IS THIS VB6 ???????????
IS THIS VB6 ???????????
•
•
Join Date: Aug 2008
Posts: 1,162
Reputation:
Solved Threads: 137
nice catch, got in a hurry and have been used to c# for a bit
you do need to add a reference to scrrun.dll
you do need to add a reference to scrrun.dll
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
If Not (oFile.FileExists(basePath & filename + ext)) Then filename = "mypic" + ext End If
Custom Application & Software Development
www.houseshark.net
www.houseshark.net
•
•
Join Date: Aug 2008
Posts: 1,162
Reputation:
Solved Threads: 137
Custom Application & Software Development
www.houseshark.net
www.houseshark.net
![]() |
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Array parameter passing
- Next Thread: query not working
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age append application basic beginner birth bmp calculator cd cells.find click client code college column component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report retrieve save search sendbyte sites sort sql sql2008 sqlserver subroutine table tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows






