Tuesday, April 4, 2017

Power of a Number in Visual Basic NET

Here is a sample program that will ask the user to give the base and exponent value and then our program will compute the power value of the given base and exponent number by our user using Microsoft Visual Basic NET as our programming language.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.





Sample Program Output

Program Listing

Public Class Form1

    Private Sub Label1_Click(sender As Object, e As EventArgs) Handles Label1.Click

    End Sub

    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
        End
    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim base, exponent, compute As Integer

        base = Val(TextBox1.Text)
        exponent = Val(TextBox2.Text)

        compute = Math.Pow(base, exponent)
       
        Label5.Text = "The power value is  " & compute & "."
    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        TextBox1.Text = ""
        TextBox2.Text = ""
        Label5.Text = ""
        TextBox1.Focus()
    End Sub
End Class



No comments:

Post a Comment