Yes No Confirmation Message Box using VB.Net

Last Reply on Oct 18, 2016 03:52 AM By Indresh

Posted on Oct 17, 2016 02:40 AM

Is there any other option to display a message in server since this way it cannot show a message?

Dim msgRslt As MsgBoxResult = MsgBox("Jig tool succussfully registered. Do you want to continue register jigtool? .", MsgBoxStyle.YesNo)
If msgRslt = MsgBoxResult.Yes Then
   Response.Redirect("regJig.aspx")
ElseIf msgRslt = MsgBoxResult.No Then
   Response.Redirect("home.aspx")
End If

 

Posted on Oct 18, 2016 03:52 AM Modified on on Oct 18, 2016 04:01 AM

Hi mayu3491,

I have created sample code which fullfill your requirement.

HTML

<div>
    <asp:Button ID="btnSubmit" Text="Submit" runat="server" Style="height: 26px" />
</div>

Vb.net

Imports System.Windows.Forms

Partial Class _Default
    Inherits System.Web.UI.Page

    Protected Sub btnSubmit_Click(sender As Object, e As System.EventArgs) Handles btnSubmit.Click
        Dim result As DialogResult = MessageBox.Show("Jig tool succussfully registered. Do you want to continue register jigtool? .", "Confirmation", MessageBoxButtons.YesNo)
        If result = DialogResult.Yes Then
            Response.Redirect("regJig.aspx")
        ElseIf result = DialogResult.No Then
            Response.Redirect("home.aspx")
        End If
    End Sub
End Class

Screenshot