Click here to Skip to main content
15,889,738 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: The application does not close Pin
Gerry Schmitz20-Mar-18 17:13
mveGerry Schmitz20-Mar-18 17:13 
GeneralRe: The application does not close Pin
desanti20-Mar-18 17:24
desanti20-Mar-18 17:24 
GeneralRe: The application does not close Pin
Gerry Schmitz20-Mar-18 20:15
mveGerry Schmitz20-Mar-18 20:15 
GeneralRe: The application does not close Pin
desanti21-Mar-18 7:19
desanti21-Mar-18 7:19 
AnswerRe: The application does not close Pin
Ralf Meier20-Mar-18 23:42
mveRalf Meier20-Mar-18 23:42 
AnswerRe: The application does not close Pin
mo149221-Mar-18 2:58
mo149221-Mar-18 2:58 
GeneralRe: The application does not close Pin
desanti21-Mar-18 9:51
desanti21-Mar-18 9:51 
GeneralRe: The application does not close Pin
mo149221-Mar-18 11:31
mo149221-Mar-18 11:31 
I don't know how complicated your implementation is.

As a test I've done this.
Created Form1 and Form2

On Form1 Load I did this:

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Dim splash As New Form2
If splash.ShowDialog() = Windows.Forms.DialogResult.Cancel Then
Application.Exit()
End If

End Sub

In Form2 I just implemented a button:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
DialogResult = Windows.Forms.DialogResult.Cancel
End Sub


When the application runs and Form1 loads, Form2 is displayed from the load procedure.
Clicking the button causes Form2 to close gracefully with (DialogResult = Cancel) and return Cancel in this example and the application does not open.
Returning OK allows the app to open.

Also I tried this instead of Load() and it works also:

Private Sub Form1_Shown(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Shown
Dim dlg As New Form2
If dlg.ShowDialog() = Windows.Forms.DialogResult.Cancel Then
Application.Exit()
End If

End Sub

It should be this simple. If this does not help I can only suggest that you make sure you don't
do any initialization of data or processes prior to verifying user through the splash screen.
That is, don't initialize anything in Load() if you are showing the splash screen in Shown().

Hope this helps.

-- modified 21-Mar-18 17:50pm.
GeneralRe: The application does not close Pin
Eddy Vluggen22-Mar-18 7:00
professionalEddy Vluggen22-Mar-18 7:00 
Questionprinting data to report in crystal report Pin
Kim Gabinete18-Mar-18 7:03
Kim Gabinete18-Mar-18 7:03 
SuggestionRe: printing data to report in crystal report Pin
Richard MacCutchan18-Mar-18 7:40
mveRichard MacCutchan18-Mar-18 7:40 
GeneralRe: printing data to report in crystal report Pin
Mycroft Holmes18-Mar-18 12:57
professionalMycroft Holmes18-Mar-18 12:57 
QuestionRe: printing data to report in crystal report Pin
Eddy Vluggen18-Mar-18 9:09
professionalEddy Vluggen18-Mar-18 9:09 
AnswerRe: printing data to report in crystal report Pin
Gerry Schmitz18-Mar-18 15:49
mveGerry Schmitz18-Mar-18 15:49 
Questionpattern printing Pin
Member 1372813915-Mar-18 3:06
Member 1372813915-Mar-18 3:06 
SuggestionRe: pattern printing Pin
Richard MacCutchan15-Mar-18 4:00
mveRichard MacCutchan15-Mar-18 4:00 
QuestionEntity framework : refreshing a single object from database. Pin
desanti10-Mar-18 15:10
desanti10-Mar-18 15:10 
AnswerRe: Entity framework : refreshing a single object from database. Pin
Dave Kreskowiak11-Mar-18 13:10
mveDave Kreskowiak11-Mar-18 13:10 
AnswerRe: Entity framework : refreshing a single object from database. Pin
Gerry Schmitz12-Mar-18 12:11
mveGerry Schmitz12-Mar-18 12:11 
QuestionI have a question about Visual Basic and Databases... Pin
D. Doulas10-Mar-18 10:29
D. Doulas10-Mar-18 10:29 
QuestionRe: I have a question about Visual Basic and Databases... Pin
Richard MacCutchan10-Mar-18 22:21
mveRichard MacCutchan10-Mar-18 22:21 
AnswerRe: I have a question about Visual Basic and Databases... Pin
D. Doulas11-Mar-18 10:35
D. Doulas11-Mar-18 10:35 
GeneralRe: I have a question about Visual Basic and Databases... Pin
Richard MacCutchan11-Mar-18 22:20
mveRichard MacCutchan11-Mar-18 22:20 
GeneralRe: I have a question about Visual Basic and Databases... Pin
Eddy Vluggen12-Mar-18 1:14
professionalEddy Vluggen12-Mar-18 1:14 
GeneralRe: I have a question about Visual Basic and Databases... Pin
D. Doulas12-Mar-18 9:06
D. Doulas12-Mar-18 9:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.