Re: Opening multiple files with my applicaton



try the following
Dim cla As String() = Environment.GetCommandLineArgs()
If cla.Length >= 1 Then
If cla.Length = 1 Then
ListBox1.Items.Add(cla(1))
else
for n as integer=2 to cla.length
ListBox1.Items.Add(cla(1) & iif(cla(1).endswith("\"),"","\") & cla(n))
next
End if

when there is more than 1 file the first item is the folder the others are the name
so check if 1 take one complete
if more take one and add the names

if the files are in the root the folder has already a backslash therefore check also with: iif(cla(1).endswith("\"),"","\")


Jan


"kimiraikkonen" <kimiraikkonen85@xxxxxxxxx> schreef in bericht news:567d287b-fd3c-493e-aa4c-9856573dc304@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi,
I have an app which has a listbox and when i double click an
associated fileS, i want their paths to be added into listbox in my
application.

This code works good when i try to open a "single" file with my app
which works to get commandline arguments to get file paths:

Dim cla As String() = Environment.GetCommandLineArgs()
If cla.Length > 1 Then
ListBox1.Items.Add(cla(1))
End if

But this doesn't work while opening more than one files at the same
time.

Assume i select 3 files with pressing CTRL + left mouse and then "open
with" my application, then i want these three files' paths must be
added as items into the listbox. (listbox will have 3 items, items are
the paths of files)

I hope you can help.

Regards.

.



Relevant Pages

  • RE: Opening multiple files with my applicaton
    ... i want their paths to be added into listbox in my ... This code works good when i try to open a "single" file with my app ... Dim cla As String= Environment.GetCommandLineArgs ... Dim idx as Integer ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Opening multiple files with my applicaton
    ... i want their paths to be added into listbox in my ... Dim cla As String= Environment.GetCommandLineArgs ... Dim idx as Integer ... try to open more than one file "with" my app by selecting CTRL + mouse ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Opening multiple files with my applicaton
    ... Dim cla As String() = Environment.GetCommandLineArgs ... i want their paths to be added into listbox in my ... What's the correct coding to add multiple files' paths into listbox ...
    (microsoft.public.dotnet.languages.vb)
  • setting tabs in a string
    ... I am filling a server side listbox in an asp.net app ... Each text value for each item in the list is created by concatenating to ... adding a string with spaces in the middle does nothing. ...
    (microsoft.public.dotnet.general)
  • Listbox And Combobox Control Buffer Overflow
    ... = Listbox And Combobox Control Buffer Overflow ... As past history has shown us, Windows has many buffer overflow resulting ... Pointer to the null-terminated string that ... After sending a message with a large pathname utilman will cause an ...
    (Bugtraq)