How to Print/Display/Output Messages in VB .Net 2013
Dim Yr As Integer = 15
Dim Mth As Integer = 3
Dim Dt As Integer = 27
MessageBox.Show("Hello You are " + Yr.ToString + " Years " + Mth.ToString + " 
    Months " + Dt.ToString + " Days")
'-------------------------------------------------------------------------------------------
 Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

        MessageBox.Show("Welcome U in Codershelpline")

        MsgBox("Welcome U in Codershelpline")
 End Sub
'-------------------------------------------------------------------------------------------
MessageBox.Show(Me, "Incomplete information", "Login Error")
MessageBox.Show("Incomplete information", "Login Error")

'Incomplete information=Message text.
'Login Error=Title of message box.
'-------------------------------------------------------------------------------------------
 Label1.Text = "Pls Enter user id and password."
'-------------------------------------------------------------------------------------------
       If TextBox1.Text = "" Then
            'MsgBox("Please Enter Customer Id", MsgBoxStyle.Critical, "Save Error")
            'MessageBox.Show("Codershelpline","Important Message")
            'MessageBox.Show("Codershelpline", _
                         "Important Message")
            'MsgBox("Please Enter Customer Id", MsgBoxStyle.Exclamation, "Save Error")
            'MsgBox("Please Enter Customer Id", MsgBoxStyle.Information, "Save Error")
            'MsgBox("Please Enter Customer Id", MsgBoxStyle.Question, "Save Error")
            'MsgBox("Please Enter Customer Id", MsgBoxStyle.OkCancel, "Save Error")
            'MsgBox("Please Enter Customer Id", MsgBoxStyle.YesNo, "Save Error")
            'MsgBox("Please Enter Customer Id", MsgBoxStyle.YesNoCancel, "Save Error")
            MsgBox("Please Enter Customer Id", MsgBoxStyle.AbortRetryIgnore, "Save Error")
            TextBox1.Focus()
            Exit Sub
       End If

'NB: Here "Save Error" is the message appeared as title of message box.we can change it.
'-----------------------------------------------------------------------------------------
        Dim k as Integer = MsgBox("DO YOU WANT TO EDIT AGAIN", MsgBoxStyle.YesNo)
        Dim k as Integer = MsgBox("Do You Want To Close The Application [Y/N]?",  
                                   MsgBoxStyle.YesNo,"Close the Application")
        If k = 6 Then
           DataGridView1.Visible = False     
        End If

'NB:Here 6 is the ASCII value for choosing Yes option from appeared message box.
'-----------------------------------------------------------------------------------------
'Code to Put Data as Message in a Text Box
  TxtMsgBox.Text=Val(TxtQty1.Text) & " Consumed And " & Val(TxtQty2.Text) & " Wastage."
'----------------------------------------------------------------------------------------
'Code to display data as 11-08-2019 or 11-Aug-2019 format 
   Dim dateAsString As String = DateTime.Now.ToString("dd/MM/yyyy")
   Dim dateAsString As String = DateTime.Now.ToString("dd/MMM/yyyy")
   MsgBox(dateAsString)

 350 total views,  2 views today

Categories: VB .Net

0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.