Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
teifivalley  
#1 Posted : Tuesday, November 15, 2005 9:38:08 PM(UTC)
teifivalley

Rank: Member

Groups: Member
Joined: 9/22/2005(UTC)
Posts: 5

I was expecting to see the image name and path currently displayed in a BitmapViewer control as one of the properties but don't seem to be able to find something relevant
eg

Code:
Private Sub BitmapViewer2_GotFocus()
    MsgBox Me.BitmapViewer2.Value 'returns current image and path displayed in control
End Sub


It obviously doesn't work like this.
Could you tell me how I return the name of the current image displayed in the control
Thanks
Teifivalley

Edited by user Sunday, December 23, 2007 4:52:28 PM(UTC)  | Reason: Not specified

Teifivalley
Gadget  
#2 Posted : Thursday, November 17, 2005 5:00:30 AM(UTC)
Gadget

Rank: Member

Groups: Member
Joined: 8/30/2005(UTC)
Posts: 5

Teifivalley,
Here is what i do, I save the name when it is loaded so that I can use the same filename in other parts of the program if i need to. If you are using only a single form(VB) in the general section:

Dim imagefile as string

If you use multiple forms you woiuld want to put it in a module so that you can use it anywhere in your app.
Public imagefile as string

Then when the user loads the image say:
imagefile=dialog.filename

Once you have set the varible you can then call it anytyime you need it.

Code:
bm.bitmap.loadfromfile(imagefile)
me.caption="The file that is loaded is " & imagefile
recordset("image")=imagefile


Etc.

Ira Whitney

Edited by user Sunday, December 23, 2007 4:52:43 PM(UTC)  | Reason: Not specified

teifivalley  
#3 Posted : Thursday, November 17, 2005 5:00:48 PM(UTC)
teifivalley

Rank: Member

Groups: Member
Joined: 9/22/2005(UTC)
Posts: 5

Thanks for your reply, - I have actually done the same as a temporary stop gap but the projects form could display up to 30 images built on the fly. A bmviewer property would be a neater solution than having to keep track of all these variables.
Thanks Richard
Teifivalley
Andrew  
#4 Posted : Friday, January 6, 2006 12:45:10 PM(UTC)
Andrew

Rank: Advanced Member

Groups: Member, Administration
Joined: 8/2/2003(UTC)
Posts: 876

Thanks: 2 times
Was thanked: 27 time(s) in 27 post(s)
Richard,

BitmapViewer does not keep any filenames. It can display images not only loaded from files, that's why it would not have any sense to store filenames. Instead of it, BitmapViewer keeps the image itself which is available through the Bitmap property.

However each VB6 control (including BitmapViewer) has a Tag property. You can use it to store your custom data. In particular you can write the file name of the image when you load it into the BitmapViewer.

Code:
Dim strFilename
strFilename = "C:\[Test Files]\test.gif"
BitmapViewer1.Bitmap.LoadFromFile(strFilename)
BitmapViewer1.Tag = strFilename 


Hope this helps.

Edited by user Sunday, December 23, 2007 4:52:53 PM(UTC)  | Reason: Not specified

Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.