Solved

open image in paintbrush

Posted on 2001-08-09
3
289 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
ID: 6370449

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
ID: 6371849
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
ID: 6378384
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

914 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

16 Experts available now in Live!

Get 1:1 Help Now