I'm extremely new to computer programming so please forgive me.
I've so far learnt about file types, like integers, strings, and arrays using the various learning videos as a reference (see profile) but I can't integrate the techniques at all really as I am new, another great hobby to learn about I suppose.
However, after some experimenting I have become to understand Visual Basic a little, seems a bit like the English language with the If, And, Else statements, which I like! The range of options in intelli sense is great too, very handy
So for example, say I want to create a small, very basic example application to do the following task: delete a folder.
something like this:
when user(me) clicks button1(a button) with checkbox ticked(named: "remove example folder), the following folder is removed: C:\WINDOWS\example
i can do that, im really happy! after some long experiments, and references from the "MSDN" pages, i came up with this:
If
My.Computer.FileSystem.DirectoryExists("C:\WINDOWS\Example") And CheckBox1.Checked Then RmDir("C:\WINDOWS\Example") messagebox.show("example folder has been removed")
so i thought i could spice up the application by experimenting with some more code.
What i'm looking to do is: if i click the button without the tickbox ticked, to return the appropriate value, ie, a messagebox.show with "example folder has been deleted already"
so i unsuccessfully tried:
If My.Computer.FileSystem.DirectoryExists("C:\WINDOWS\example") And CheckBox1.Checked Then RmDir("C:\WINDOWS\example")
MessageBox.Show(
"example folder deleted") <---this whole block of of code seems to worknext code---->
If Not My.Computer.FileSystem.DirectoryExists("C:\WINDOWS\example") And CheckBox1.Checked Then MessageBox.Show("nothing to remove")
wrote underneath the button1_click event
However if I click the button when checkbox is ticked, or is not ticked, the "nothing to remove" message is only displayed, instead of just displaying it when it is ticked and theres nothing to remove.
Do I need to learn more about using booleans first What do you think
Thanks
![]()
Steve

Working with DirectoryExists
Delphyne
Hi Steve,
You can combine the two If statments into one with "Else If" so that only the one which meets the condition executes.
If My.Computer.FileSystem.DirectoryExists("C:\WINDOWS\example") And CheckBox1.Checked Then
RmDir("C:\WINDOWS\example")
MessageBox.Show("example folder deleted") <---this whole block of of code seems to work
Else If Not My.Computer.FileSystem.DirectoryExists("C:\WINDOWS\example") And CheckBox1.Checked Then
MessageBox.Show("nothing to remove")
End If