VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,732 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi ,how can I get out of form and go on to the program?
Please explain me by example.
Thanks
Try this:
Private Sub btnLoadForm_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLoadForm.Click
Dim Form2 As New Form
Form2.ShowDialog()
'Code placed after this will be executed after the form is closed.
End Sub
Or if you want to show the form and also execute code at the same time, try this:
Private Sub btnLoadForm_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLoadForm.Click
Dim Form2 As New Form
Form2.Show()
'Code placed after this will be executed while the form is still there.
End Sub
Hi,
you can use console application and show Form (eg. Form1) and after closing form continue with next code like in following demo:
Imports System.Windows.Forms
Module Module1
Sub Main()
Try
Dim c As New Demo
c.Execute()
Catch ex As Exception
Console.WriteLine(ex.ToString)
End Try
Console.WriteLine("Continue enter key")
Console.ReadKey()
End Sub
Friend Class Demo
Friend Sub Execute()
Application.EnableVisualStyles()
Application.SetCompatibleTextRenderingDefault(False)
Application.DoEvents()
Application.Run(New Form1())
'
' next code after closing Form1
Console.WriteLine("next code")
End Sub
End Class
''' <summary>
''' Form1 for demo purposes
''' </summary>
Friend Class Form1
Inherits Form
Private Label1 As New Label() With {.Text = "Form 1 loaded"}
Public Sub New()
AddHandler Me.Load, Sub()
Me.Controls.Add(Label1)
End Sub
End Sub
End Class
End Module