Murray Brown
asked on
VB.net Prompt user using Windows form
Hi
I have a Windows Form that I use to prompt the user. It is loaded with a list that the user
has to make a selection from.
I have an OK button that then runs the rest of the code.
Is there a way to pause the code, show the form and then run the rest of the code
without havening to channel it through the OK button?
In essence, I want the Windows form to gather feedback just like the OpenFileDialog would in the
following code and gather feedback from the user
With Globals.ThisAddIn.oAUTOMAT OR.OpenFil eDialog1
.FileName = ""
.InitialDirectory = System.Environment.GetFold erPath(Env ironment.S pecialFold er.MyDocum ents)
.Filter = Nothing
'.AddExtension
.ShowDialog()
sFileAndPath = .FileName
sPath = System.IO.Path.GetDirector yName(sFil eAndPath)
sFile = System.IO.Path.GetFileName (sFileAndP ath)
oSource_File = sFileAndPath
End With
I have a Windows Form that I use to prompt the user. It is loaded with a list that the user
has to make a selection from.
I have an OK button that then runs the rest of the code.
Is there a way to pause the code, show the form and then run the rest of the code
without havening to channel it through the OK button?
In essence, I want the Windows form to gather feedback just like the OpenFileDialog would in the
following code and gather feedback from the user
With Globals.ThisAddIn.oAUTOMAT
.FileName = ""
.InitialDirectory = System.Environment.GetFold
.Filter = Nothing
'.AddExtension
.ShowDialog()
sFileAndPath = .FileName
sPath = System.IO.Path.GetDirector
sFile = System.IO.Path.GetFileName
oSource_File = sFileAndPath
End With
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks very much. That is exactly what I was looking for. The question was probably not that clear.
That will cause another problem: the line that follows check for .FileName which will be empty at best.
That means that you cannot have code after .Show that is dependant on the result of the dialog box.