i need help. i am learning VB and am trying to display a 'welcome' message when the form appears to the screen using the messagebox.show

this is a very simple application consisting of only one form. a simple calculator

this is how my code looks so far.

Public Class Form1


   Private Sub calculatebtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles calculatebtn.Click
        Dim Resultsng As Single
        Dim Pricesng As Single
        Dim Quantityint As Integer
        Try
            'Get data from user
            Pricesng = CSng(pricetxt.Text)
            Quantityint = CInt(quantitytxt.Text)

            'Calculate results
            Resultsng = CSng(Pricesng * Quantityint * 1.085)
            Totallbl.Text = CStr(Resultsng)
        Catch ex As InvalidCastException
            MessageBox.Show("Please type numbers only")
        Catch ex As OverflowException
            MessageBox.Show("Please enter a smaller number")
        Catch
            MessageBox.Show("An error occured due to data type")
        End Try

    End Sub

    Private Sub resetbtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles resetbtn.Click
        pricetxt.Clear()
        quantitytxt.Clear()
        Totallbl.Text = String.Empty
        'Return cursor to price box after clearing
        pricetxt.Focus()

    End Sub

    Private Sub quitbtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles quitbtn.Click
        Me.Close()
    End Sub


End Class

MessageBox.Show

You're in the wrong forum. But that's ok, VB.Net is about the same as VB6.

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        MessageBox.Show("Welcome, to my Calculator", "Welcome", MessageBoxButtons.OK)
End Sub

MessageBox.Show

You're in the wrong forum. But that's ok, VB.Net is about the same as VB6.

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        MessageBox.Show("Welcome, to my Calculator", "Welcome", MessageBoxButtons.OK)
End Sub

The topic starter uses VB.NET already lood at his codes you'll see the diff between VB6 and .NET

Anyway, i guess the this is solved by your code above.

:)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.