简体   繁体   中英

Open Associated Files in VB.net

I am trying to associate multiple files with my app i have done associating files but when i try to open multiple files app open just one file, to open the file iam using this code in form load event

        For Each arg In My.Application.CommandLineArgs
            open_File(return_rtb, arg)
        Next arg

And the second problem is myApp is single instance app how to catch if user double click on a file while myApp is running like form load event for first time. thanks

This is a built-in capability for VB.NET, provided by the application framework option, turned on by default for a Winforms app. Project + Properties, Application tab, tick the "Make single instance application" option.

Use the My.Application.StartupNextInstance event. The code snippet in the MSDN library article for this event shows you how to use the e.CommandLine property to discover the path of the file passed to the second instance.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM