hey all,

I have a form where a user selects from a couple radio buttons. once THAT button is selected i want a new form to load where the user has to fill out personal info and submit.

what's the best and easiest way to set this up?

like:

1) button selected
2) that form disappears
3) new form that requires text info loads

Dani AI

Generated

Brief, practical follow-up that builds on the replies from , , and .

Designing the new form
Open the new form in the Windows Forms Designer (Solution Explorer -> double-click the form). Use the Toolbox to add Label, TextBox and Button controls, give each control a clear Name (for example txtName, btnOK), set TabIndex for keyboard order, and set the form’s AcceptButton and CancelButton so Enter/Escape behave as expected. Put the submit button’s DialogResult to OK so a successful submit closes the dialog automatically. (Designer docs: .)

Showing the form and returning data
For required input prefer a modal dialog — it prevents the user from continuing until they finish. From the caller form hide or leave the caller visible, create the dialog, call ShowDialog, then read properties you expose on the dialog. Example pattern:

Me.Hide()
Using dlg As New PersonalInfoForm()
    If dlg.ShowDialog() = DialogResult.OK Then
        Dim name = dlg.UserName
        Dim email = dlg.Email
        ' process the data here
    End If
End Using
Me.Show()

Expose entered values as read-only properties on the dialog:

Public ReadOnly Property UserName As String
    Get
        Return txtName.Text.Trim()
    End Get
End Property

Validation, disposal and shutdown notes
Validate inputs inside the dialog (Validating events or an ErrorProvider) and prevent closing until entries are valid. Use a Using block or call Dispose so dialogs don’t leak resources. If the form you close is the startup form the app may exit (as warned). To avoid that either hide the startup form, show dialogs modally, or change the VB project “shutdown” option to “When last form closes.” For modal behavior reference: Form.ShowDialog.

Troubleshooting tips: ensure the OK button’s DialogResult and the form’s AcceptButton are set, validate with ValidateChildren() before accepting, and use clear control names so data retrieval is straightforward.

Recommended Answers

All 4 Replies

on button click event
me.close()
frmnewform.show()

commented: You should know about code tags by now! -2
commented: You must act. -2

frmnewform.show()
me.close()
else the application will shut down if his properties are set to "shutdown when startupp form closeing"

thanx babbu and geek.

i got that working great.

now, with the new form that loads... how do i edit it? you know, add text boxes, labels buttons, etc.?

any suggestions?

Drag the toolsfrom the tool box onto the form

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.