Thursday 3 May 2012

VB.NET or C# forms Conformation Box | Display conformation box in .NET | Alert box in VB.NET or C#

                                       Hi Friends, in this article i will explain about VB.NET or C# forms Conformation Box.
I already explained the articles on windows forms.If you want click onWindows Forms.
Basically we know about how to display conformation box in javascript.The conformation is like below.


Let we know about how to create Conformation Box in VB.NET windows Forms.
Copy and paste the below code in your project.

Dim Box As MsgBoxResult = MsgBox("Are You Sure You Wish To Delete This ?", MsgBoxStyle.YesNo)

        If Box = MsgBoxResult.Yes Then
            MsgBox("Done")
        Else
            MsgBox("Not Done")
        End If


First of all goto File ---New –Project --- Enter the name of the project ---OK
Goto to code view or double click on the windows form.In the Page_Load write the following code.
Code in VB.NET:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim Box As MsgBoxResult = MsgBox("Are You Sure You Wish To Delete This ?", MsgBoxStyle.YesNo)

        If Box = MsgBoxResult.Yes Then
            MsgBox("Done")
        Else
            MsgBox("Not Done")
        End If
    End Sub


Code in C#:

MsgBoxResult Box = Interaction.MsgBox("Are You Sure You Wish To Delete This ?", MsgBoxStyle.YesNo);

if (Box == MsgBoxResult.Yes) {
     Interaction.MsgBox("Done");
} else {
     Interaction.MsgBox("Not Done");
}

Then run the code or press F5. The output will like below.


When we run the form first conformation box is appear and if u press Yes then Done  messagebox will come or if you press No then Not done messagebox will come. Windows form  appear when you press Ok.

"If you like my blog or articles, you can appreciate by leaving your comments or Liking my Facebook page Aspdotnet-kishore, following on Google+ Aspdotnet-Kishore, Twitter  on AspdotnetKishore, Linked in Aspdotnet-Kishore, stumbling my posts on stumble upon and subscribing on  RSSfeed Aspdotnet-Kishore for free updates directly to your Email inbox . Watch my blog  for more articles."

No comments:

Post a Comment

© 2012-2018 Aspdotnet-Kishore.blogspot.com. All Rights Reserved.
The content is copyrighted to Kishore and may not be reproduced on other websites without permission from the owner.