A couple issues with vb.net and dialog boxes

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm working on a program that involves one dialog box. The dialog box is launched from a class called myCommands using the following line of code:
Autodesk.AutoCAD.ApplicationServices.Application.ShowModalDialog(dwgForm)
There are several text boxes and radio buttons on this dialog box. If the user forgets to fill out or select one of these, I would like a message box to display a message then revert back to the main dialog after selecting OK.
To do that, I added this code to the OK button:
'check for size selection If rdbTitleA.Checked = False And rdbTitleB.Checked = False And rdbTitleC.Checked = False And rdbTitleD.Checked = False Then MsgBox("Please select a size to continue.") Exit Sub End If 'check for initials If txtIni.Text = vbNullString Then MsgBox("Please enter your initials.") Exit Sub End If 'check for folder selection If intFolder < 2 Then MsgBox("Please select an appropriate folder") Exit Sub End If 'check for description If txtDesc1.Text = vbNullString Then MsgBox("Please type a description") Exit Sub End If
Currently, when a user forgets to specify something in the dialog, the message box appears, but after selecting OK, the dialog box disappears, but the code from the myCommands class continues to execute.
What is the proper method to add in this type of error handling when working between a dialog box and a separate class?
I'm having another issue as well. After the user completes everything in the dialog box and selects OK, the program works properly. However, when the user selects that program again, within the same drawing, the dialog box reappears with all of the same info specified from the last time the program ran. Obviously, I want the dialog to start over clean, without all of the old data. What am I doing wrong?
Thanks
btm