Go to GoReading for breaking news, videos, and the latest top stories in world news, business, politics, health and pop culture.

How to Program the Calculate Button in Vb.Net

104 19
    • 1). Click the Windows "Start" button and select "All Programs." Click ".NET Framework" to view a list of programming utilities. Click "Visual Studio" to open the .NET programming platform.

    • 2). Click "File," then "Open." Double-click your VB.NET project file to open the code file where you do your calculations.

    • 3). Right-click the form that contains your calculate button. Select "Design View." This shows you the form in a wizard designer. Double-click the "Calculate" button to open the "OnClick" event.

    • 4). Type the calculation code. For instance, if you have two numbers in a text box labeled "Text1" and "Text2," you use the typical math characters to add the figures and save the result to a variable. The following code calculates two values in VB.NET:

      Dim result As Integer

      result = Text1.Text.ToInt32() + Text1.Text.ToInt32()

    • 5). Display the result of the calculation. In this example, a popup window shows the user the result of the calculation. Type the following code into your code file:

      MsgBox "The result of the calculation is" & result

Source...

Leave A Reply

Your email address will not be published.