Solved

open image in paintbrush

Posted on 2001-08-09
3
299 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 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone 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

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…
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…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

733 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