CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 11 of 11
  1. #1
    Join Date
    Jan 2012
    Posts
    16

    activate file save command [Copy data from another application]

    I am running an application from my desktop as you see on the picture,and I don't know how to run File Save command on active form without mouse click,only with vb.application?
    Attached Images Attached Images  
    Last edited by Cimperiali; February 17th, 2012 at 06:38 AM. Reason: Changing title accordingly to real quest

  2. #2
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: activate file save command

    There is no file save on your menu so a mouse click would not do it either.

    There also is no "file save" command, how a file is saved is up to the program doing the saving and can vary greatly.

    What are you trying to do?
    Always use [code][/code] tags when posting code.

  3. #3
    Join Date
    Jun 2005
    Location
    JHB South Africa
    Posts
    3,772

    Re: activate file save command

    Edit your menu and add Save to the list .....

    Then add the Save code to the click event ...
    Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
    WPF Articles : 3D Animation 1 , 2 , 3
    Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
    Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
    All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.

  4. #4
    Join Date
    Jan 2012
    Posts
    16

    Re: activate file save command

    Sorry..I need file open,not file save,my word mistake.
    Solution?

  5. #5
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: activate file save command

    You have not given us much to go on. If you mean you want to fire the event from code then just click on it in the designer and look at the name of the sub routine being called there and then make a call to that sub routine from where ever. Or if you mean that you want to execute the event from the keyboard as you can see it is mapped to CTRL+O

    If you are looking to display the open file dialog then you should look up the file open dialog in your online help.

    If you are looking for code to actually open the file then the method you should use depends on what kind of file it is and what you are planning to do with it.

    There is no magic Open File command.
    Always use [code][/code] tags when posting code.

  6. #6
    Join Date
    Jan 2012
    Posts
    16

    Re: activate file save command

    EXAMPLE:CTRL+O or CTRL+C or CTRL+S= It does not matter
    Code:
    Public Class Form1
        'Button1=RUN button
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            System.Diagnostics.Process.Start("calc")
    
        End Sub
        'Button2=COPY Button
        Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
            SendKeys.Send("^c")
        End Sub
    End Class
    If I success with this problem I will success with my application above,because it's similar problem.

    Any idea?
    Last edited by Cimperiali; February 17th, 2012 at 06:33 AM. Reason: Modified Code: to [code] tag

  7. #7
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: activate file save command

    I still do not know what you are trying to do? Are you trying to sendkeys to another application or are you trying to pull up the open file in your application.

    If you are trying to send keys to another application the first thing you need to do is make sure the other application has focus which it will not have in your example as your app must get focus in order for you to click the button which means you are sending keys to your own app.

    What is it that you are actually trying to do?

    In general Sendkeys is not a good approach to most things.
    Always use [code][/code] tags when posting code.

  8. #8
    Join Date
    Jan 2012
    Posts
    16

    Re: activate file save command

    Yes,I trying to sendkey(ex.copy) to another application(ex.calculator) using my COPY button from my application.How to do that?

  9. #9
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: activate file save command

    Why would you want to send a key to another app from a button? This makes no sense why not just hit the key in the app you want it to go to?

    I am wondering why you are not telling us what app you are trying to send keys to or why, perhaps a questionable persuit? I will repeat the clue I gave before in that you must have focus on the application the key is to be sent to before you can sendkeys to it.

    If you want more tell us what you are really trying to do and I know it is not calculator.
    Always use [code][/code] tags when posting code.

  10. #10
    Join Date
    Jan 2012
    Posts
    16

    Re: activate file save command

    You are so curious :-).Suffice it to say that I wanna get some information from application which I am not autor.I will never make application like that,so I just wanna use as a gift.

    p.s.It is a free app.
    Tnx

  11. #11
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: activate file save command

    Try this:

    Code:
    &Open
    To get Open, then, like any other menu ALT-O
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured