Loading

Message box in vb.net

Submitted by: 


You have to do two things for creatng a messagebox in vb.net
1) In design mode add the following codes after

  1. <script>
  2. <asp:Literal ID="ltlAlert" runat="server" EnableViewState="False"></asp:Literal>
  3. </script>

2). Add the following codein Code Behind

  1. Partial Class _Default
  2.  
  3. Inherits System.Web.UI.Page
  4. Protected WithEvents Literal As System.Web.UI.WebControls.Literal
  5. Private Sub Say(ByVal Message As String)
  6. ' Format string properly
  7. Message = Message.Replace("'", "\'")
  8. Message = Message.Replace(Convert.ToChar(10), "\n")
  9. Message = Message.Replace(Convert.ToChar(13), "")
  10. ' Display as JavaScript alert
  11. ltlAlert.Text = "alert('" & Message & "')"
  12. End Sub
  13.  
  14.  
  15. Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
  16. Say("asasas")
  17. End Sub
  18. End Class

About the author:

PlanetSourceCode.in is a place for all developer providing free source codes, articles, complete projects,complete application in PHP, C/C++, Javascript, Visual Basic, Cobol, Pascal, ASP/VBScript, AJAX, SQL, Perl, Python, Ruby, Mobile Development




Comments

make the youtube url a link intsead

Pages

Add new comment

Filtered HTML

  • You may insert videos with [video:URL]
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <asp>, <c>, <cpp>, <csharp>, <css>, <html4strict>, <java>, <javascript>, <mysql>, <php>, <python>, <sql>, <vb>, <vbnet>. The supported tag styles are: <foo>, [foo].
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.