Dialog Box - Buffer Overflow Error

I have a VB.NET app in which I am trying to provide the ability to select a directory to which you would like to save data.

The code for this is below:

Me.FolderBrowserDialog1.Description = _
            "Select the directory that you want to use As the default."

        If FolderBrowserDialog1.ShowDialog() = DialogResult.OK Then
            txtCardLoc.Text = FolderBrowserDialog1.SelectedPath
        End If

When I run the code I get the following error:

An unhandled exception of type 'System.StackOverflowException' occurred in system.windows.forms.dll

Please help.  The microsoft documentation seems to show the same basic method for this functionality.  Is there something else that I am supposed to reference or a component I need to add?
BodeTechAsked:
Who is Participating?
 
SRigneyConnect With a Mentor Commented:
This can happen when you have a recursive call and doen't know it.

What is the name of the function that this code is in?
0
 
BodeTechAuthor Commented:
You were correct, I had the function happening on "GotFocus" and that was being called over and over and over and over...etc.

Thanks for the help!
0
All Courses

From novice to tech pro — start learning today.