filebox1.path = dirbrowser1.path

New to Gambas? Post your questions here. No question is too silly or too simple.
Post Reply
theyikes
Posts: 16
Joined: Wednesday 18th September 2024 7:05pm

filebox1.path = dirbrowser1.path

Post by theyikes »

Hey! Ok I've been using Gambas for about 20 minutes, it's cool! So far I've managed to create folders and files but I'm kind of stuck on this one. I have a filebox and a dirbrowser. I'd like to be able to change the filebox directory to match the Dirbrowser one when i click on the browser. I know it's basic but i kind of need your help. I promise it's the first and last question of the night people!

Regard
The Yikes
theyikes
Posts: 16
Joined: Wednesday 18th September 2024 7:05pm

Re: filebox1.path = dirbrowser1.path

Post by theyikes »

it's okay, i figured it out, for those who may be following in my footsteps the answer is FileBox1.Path = DirChooser1.SelectedPath
theyikes
Posts: 16
Joined: Wednesday 18th September 2024 7:05pm

Re: filebox1.path = dirbrowser1.path

Post by theyikes »

on a seperete question I'm trying to create a folder. I can use
mkdir "/home/Auser/Desktop/gambas4"
but i cannot use
Mkdir FileChooser1.SelectedPath "Gambas4"
any tips?
User avatar
thatbruce
Posts: 223
Joined: Saturday 4th September 2021 11:29pm

Re: filebox1.path = dirbrowser1.path

Post by thatbruce »

theyikes wrote: Wednesday 18th September 2024 7:46pm Mkdir FileChooser1.SelectedPath "Gambas4"
Mkdir FileChooser1.SelectedPath &/ "Gambas4"
theyikes
Posts: 16
Joined: Wednesday 18th September 2024 7:05pm

Re: filebox1.path = dirbrowser1.path

Post by theyikes »

Thank you The Bruce! Love the name!!! I have one more quick question. It has to do with error handling. When i execute my script and i create a folder is there anyway of preventing from crashing if i try to recreate said folder? Please excuse the newbie questions but I'm only a little bit experienced in visual basic.

Regards:

TheYikes
User avatar
BruceSteers
Posts: 1825
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: filebox1.path = dirbrowser1.path

Post by BruceSteers »

Use Try to catch errors
Error management Gambas wiki

Try MkDir FileChooser1.SelectedPath &/ "Gambas4"
If Error Then
  Message.Error(Error.Text & "\n" FileChooser1.SelectedPath &/ "Gambas4")
Endif


This is a good read for new starters https://gambaswiki.org/wiki/cat
Welcome to the wonderful world of gambas :)
If at first you don't succeed , try doing something differently.
BruceS
Post Reply