Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Making IF statements wait for user input?

I'm making a program that requires the user to define a folder for saving things in.
I'm using a Folder Browser Dialog to get the user to choose the folder, and then a dialog box pops up telling them which folder they've chosen and asking for confirmation. If they don't choose a folder, it's supposed to bring up another dialog box directing them to the menu where they can define one afterwards.

[code]If My.Settings.folderDefined = False Then
Dim okay As Boolean 'this is whether the user is okay with the selected folder


FolderBrowserDialog1.ShowDialog()
My.Settings.defaultFolder = FolderBrowserDialog1.SelectedPath
dlgFolderConfirm.Show()
dlgFolderConfirm.lblNotifications.Text = My.Settings.defaultFolder & Chr(10) & "Is this okay?"

If dlgFolderConfirm.DialogResult = System.Windows.Forms.DialogResult.Yes Then
okay = True
ElseIf dlgFolderConfirm.DialogResult = System.Windows.Forms.DialogResult.No Then
okay = False
dlgNotifications.Show()
dlgNotifications.lblNotification.Text = "A folder has not been defined." & Chr(10) & "Go to Settings->Define folder... to choose one."
End If

End If[/code]

Problem is, what seems to happen is, it skims over the IF statements involving setting "okay" to True or False without waiting for the user to click 'yes' or 'no', so no matter what you select it doesn't do anything.

I know this is ridiculously basic, which is making it all the more frustrating for me. Is there something I'm supposed to put in there to make it wait for input?
Sign In or Register to comment.