[Gambas-user] Array 2 String or different approach on what im trying to do.

Stefano Palmeri rospolosco at ...152...
Tue Jan 8 20:39:09 CET 2008


Alle 19:43, martedì 8 gennaio 2008, lozza1978 ha scritto:
> Hi All.
>
> Im after a little help again (Sorry for lack of knowledge guys)
>
> I have a textbox and a browse button, you click browse, select a file and
> the file path, including filename gets added inside the textbox.
>
> what im after is the directory of the file selected, so this is what I have
>
>
> DIM Elt AS String[]
> DIM Sb AS String
> DIM Sdir AS String
> DIM sstri AS String[]
>
>   Dialog.Title = "Select A Movie File to convert 2 DVD:"
>   IF Dialog.OpenFile() THEN RETURN
>    Textbox1.Text = Dialog.Path
>
>
> Elt = Split(Textbox1.Text, "/") <--Split the path
>
> Sdir = Elt.Length - 1 <--here Im finding out how many elements in the array
> Elt.Remove(Elt.Length - 1) <-- here removing the filename, so that I have
> the directory where the file is located
>
>
> FOR EACH Sb IN Elt
>
>   PRINT sb; "/";
>
> NEXT
> PRINT
> END
>
>
> the code above works and the foreach prints the correct directory path, But
> i some how need to get the output of the foreach into a string so I can
> call the directory path using a string/variable
>
> im just confusing myself now, hope someone can understand what im trying to
> do and help me, thanks again for reading.

I'm not sure that I understood, but if you want the directory
of the file, just:

PRINT File.Dir(Dialog.Path)

Stefano




More information about the User mailing list