Solved

open image in paintbrush

Posted on 2001-08-09
3
287 Views
Last Modified: 2008-03-10
how can i open a picture or image file in paintbrush when i double click on vb picturebox image and after editing return to vb form on which i click on picture box.
0
Comment
Question by:vivek2575
3 Comments
 
LVL 12

Accepted Solution

by:
Preece earned 50 total points
Comment Utility

From MSDN on the PictureBox.Picture property:

When setting the Picture property at design time, the graphic is saved and loaded with the form. If you create an executable file, the file contains the image. When you load a graphic at run time, the graphic isn't saved with the application. Use the SavePicture statement to save a graphic from a form or picture box into a file.

Note   At run time, the Picture property can be set to any other object's DragIcon, Icon, Image, or Picture property, or you can assign it the graphic returned by the LoadPicture function.



I monkeyed around with this:

Private Sub Picture1_Click()
    Dim lRet As Integer
    lRet = Shell("mspaint.exe " & sPathandfilename)
End Sub

This call will work if you have the location of the file in a variable, sPathandfilename for instance.  

0
 

Expert Comment

by:devendra_patil
Comment Utility
Try this code.
Private Sub Picture1_Click()
Dim strPath as String
strPath = App.Path & "\temp.bmp"
SavePicture Picture1.Picture, strPath 'or Picture1.Image
Shell "MsPaint.Exe" & GetShortPathName(strPath) 'Req if ur path contains spaces
End Sub

0
 
LVL 2

Expert Comment

by:JanusFury
Comment Utility
Or...
Private Sub Picture1_Click()
Dim strPath as String
strPath = App.Path & "\temp.bmp"
SavePicture Picture1.Picture, strPath 'or Picture1.Image
Shell "Pbrush.Exe """ & strPath & """" ' Always works.
End Sub
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now