?
Solved

open image in paintbrush

Posted on 2001-08-09
3
Medium Priority
?
305 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 12

Accepted Solution

by:
Preece earned 200 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses
Course of the Month13 days, 16 hours left to enroll

800 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