Click here to Skip to main content
15,032,623 members
Home / Discussions / Windows Forms
   

Windows Forms

 
QuestionThe code of closing X and opening new form Pin
Iamateur27-May-12 22:11
MemberIamateur27-May-12 22:11 
Below is the code that is actually closing the whole application when clicked on Yes.
But,I want to close the current form and open the new form when the user clicks on X with red mark i.e. close on the form.The code I wrote is :
<pre lang="vb">Private Sub form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing

Dim response As MsgBoxResult
        response = MsgBox(&quot;Do you want to close?&quot;, MsgBoxStyle.Question + MsgBoxStyle.YesNo, &quot;confirm&quot;)
        If response = MsgBoxResult.Yes Then
            Me.Dispose()
            homepage.Show()
        Else
            If response = MsgBoxResult.No Then

                e.Cancel = True

            End If
        End If</pre>
end sub

AnswerRe: The code of closing X and opening new form Pin
Eddy Vluggen5-Jun-12 1:08
professionalEddy Vluggen5-Jun-12 1:08 
QuestionC# code problem Pin
nitish_0726-May-12 20:53
Membernitish_0726-May-12 20:53 
AnswerRe: C# code problem repost Pin
Richard MacCutchan26-May-12 21:35
mveRichard MacCutchan26-May-12 21:35 
GeneralRe: C# code problem repost Pin
nitish_0726-May-12 21:46
Membernitish_0726-May-12 21:46 
GeneralRe: C# code problem repost Pin
Richard MacCutchan26-May-12 21:55
mveRichard MacCutchan26-May-12 21:55 
AnswerRe: C# code problem Pin
Eddy Vluggen27-May-12 8:50
professionalEddy Vluggen27-May-12 8:50 
GeneralRe: C# code problem Pin
Richard Andrew x6427-May-12 11:46
professionalRichard Andrew x6427-May-12 11:46 
AnswerRe: C# code problem Pin
Manfred Rudolf Bihy30-May-12 2:20
professionalManfred Rudolf Bihy30-May-12 2:20 
GeneralRe: C# code problem Pin
Pete O'Hanlon30-May-12 2:30
mvePete O'Hanlon30-May-12 2:30 
QuestionWindows security management Pin
Bobgreen221-May-12 16:48
MemberBobgreen221-May-12 16:48 
AnswerRe: Windows security management Pin
JohnPayton21-May-12 18:16
MemberJohnPayton21-May-12 18:16 
AnswerRe: Windows security management Pin
RobCroll21-May-12 20:19
MemberRobCroll21-May-12 20:19 
AnswerRe: Windows security management Pin
Dave Kreskowiak22-May-12 2:08
mveDave Kreskowiak22-May-12 2:08 
Questionabout setup Pin
Rahul GS13-May-12 19:46
MemberRahul GS13-May-12 19:46 
AnswerRe: about setup Pin
Dave Kreskowiak14-May-12 2:08
mveDave Kreskowiak14-May-12 2:08 
AnswerRe: about setup Pin
Abhinav S21-May-12 19:57
MemberAbhinav S21-May-12 19:57 
QuestionData backup system code in vb.6.0 Pin
Nelson Dsilva9-May-12 1:07
MemberNelson Dsilva9-May-12 1:07 
AnswerRe: Data backup system code in vb.6.0 Pin
Dave Kreskowiak9-May-12 6:45
mveDave Kreskowiak9-May-12 6:45 
QuestionMoving Data from one form to another Pin
Squalllllll8-May-12 7:15
MemberSqualllllll8-May-12 7:15 
AnswerRe: Moving Data from one form to another Pin
JohnPayton8-May-12 13:48
MemberJohnPayton8-May-12 13:48 
GeneralRe: Moving Data from one form to another Pin
Suhas S kulkarni13-May-12 18:39
MemberSuhas S kulkarni13-May-12 18:39 
QuestionProperties for Button on selection by "TAB", clicked & when app loses focus Pin
All Time Programming1-May-12 3:22
MemberAll Time Programming1-May-12 3:22 
AnswerRe: Properties for Button on selection by "TAB", clicked & when app loses focus Pin
Dave Kreskowiak1-May-12 4:15
mveDave Kreskowiak1-May-12 4:15 
AnswerRe: Properties for Button on selection by "TAB", clicked & when app loses focus Pin
All Time Programming3-May-12 20:38
MemberAll Time Programming3-May-12 20:38 

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.