GeniusLife

I think it is kind of confusing, but I can't really explain much. When you double click a file such as picture or something like these then you want to find which file that window ask to open for.

For example: You double click a picture then a program pop up to view it. So how do you do that in Visual Basic programming.



Re: Visual Basic General How to get a file to respond when double click and application appear

H2

Hi,

Excuse me! I can't true speek english ! I can speek english a little !

-1-first,

write this codes in Form_Load in "windows appilication" in VB.Net2005

Code Snippet

Dim cli_filename As String = Global.Microsoft.VisualBasic.Interaction.Command

If cli_filename.StartsWith(""""c) Then cli_filename = cli_filename.Substring(1)

If cli_filename.EndsWith(""""c) Then cli_filename = cli_filename.Substring(0, cli_filename.Length - 1)

Try

Me.BackgroundImageLayout = ImageLayout.Center

Me.BackgroundImage = System.Drawing.Image.FromFile(cli_filename)

Catch ex As Exception

System.Windows.Forms.MessageBox.Show(ex.Message, "Error")

End Try

"Global.Microsoft.VisualBasic.Interaction.Command" function returned 'Command Line Input' = filepath for opening and arguments and ....

please compiled project with Build->Rebuild Solution.

-2-Next,

you must edited default program for a file type.

in Xp: Control Panel -> Folder Options -> FileTypes -> (select file type or add new file type) -> (Change or Advanced button) ->Browse -> (find and select new exe file)

or

edited windows registery in path: HKEY_CLASSES_ROOT\.extension

Bye.





Re: Visual Basic General How to get a file to respond when double click and application appear

GeniusLife

You know you don't really have to be rude about it and thank anyway.