Sidebar Ad

Categories

Create Square Root Calculator In VB.NET

Creating Square root calculator in VB.NET is easy. You can make it using function Math.Sqrt

Open Visual Studio and create a new project in Visual Basic.

new-project.png (976×601)

Add two labels (with text ‘Number’ and ‘Square Root’) , two textbox and one button (with text ‘Calculate’) in the form.

form-vb.png (300×209)

Change textbox1 name to numtxt and textbox2 name to sqtxt for your ease

In numtxt , users will enter the number of which square root is to be calculated.

In sqtxt , the calculated square root will be shown when Calculate button is pressed.

Calculate button code

Square root will be calculated using the fuction ‘Math.Sqrt’. Enter this code in calculate button

Dim num1 As Integer
num1 = Val(numtxt.Text)
sqtxt.Text = Math.Sqrt(num1)

code.png (685×185)

Build the project and run the compiled application.

result1

result-2

The application will calculate square root of given number.

I'm Tech Expert, Programmer , Web Developer, Owner Of this site and much more 😁

    Leave Your Comment

    Your email address will not be published.*