Basic Visual 6: Simple Program for Calculating Trigonometric Values

  • Thread starter MotoH
  • Start date
  • Tags
    Visual
In summary, the conversation is about a beginner at Visual Basic 6 attempting to make a program that can calculate the sine, cosine, and tangent values of an angle. The code provided is for the Pythagorean Theorem and also includes a way to get the sine, cosine, and tangent in decimal form. The person has questions about how to get the answers in fraction form and if there are inverse sine, cosine, and tangent commands available. They are also seeking forgiveness for their lack of knowledge as they are still learning.
  • #1
MotoH
51
2
Hi, I am a beginner at Visual Basic 6! I am trying to make a simple program that will allow you to enter an angle, and receive the sine, cosine, and tangent values.

the code:
Code:
Public Class Form1
    ' Imports System.Math
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim A As Double = TextBox1.Text
        Dim B As Double = TextBox2.Text
        MsgBox((A ^ 2 + B ^ 2) ^ (1 / 2))

    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim A As Double = TextBox3.Text
        Dim C As Double = TextBox4.Text
        MsgBox((C ^ 2 - A ^ 2) ^ (1 / 2))

    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Dim A As Decimal = TextBox5.Text
        
        MsgBox("cos" & " " & Math.Cos(A))
        MsgBox("sin" & " " & Math.Sin(A))
        MsgBox("tan" & " " & Math.Tan(A))



    End Sub
End Class
As you can see this is very rudimentary stuff.

The first part of the code is for the Pythagorean Theorem knowing A and B, or AorB and C.
The second part will give me the sine, cosine and tangent of an angle in a message box in decimal form.

The questions I have:
Is there a command that will make the answers appear in fraction form? I am assuming this will replace the "As Decimal" but I can't find anything in the book I have or on the microsoft website.

Are there inverse sine, cosine and tangent commands? So I can turn the fraction back into the angle (in radians or degrees)

Please forgive me if it is very simple! I am still learning!
 
Technology news on Phys.org
  • #2
MotoH said:
Is there a command that will make the answers appear in fraction form? I am assuming this will replace the "As Decimal" but I can't find anything in the book I have or on the microsoft website.

Are there inverse sine, cosine and tangent commands? So I can turn the fraction back into the angle (in radians or degrees)

Please forgive me if it is very simple! I am still learning!

As Decimal does not mean decimal but it specifies the amount of memory that should be allocated I believe.

No you can NOT get in fractions unless you do something like Math.Round .. to 2 digit places (0.35) and then multiple by 100 by get the numerator (35) and provide 100 as denominator (35/100)
 
Last edited:
  • #3

1. What is Basic Visual 6?

Basic Visual 6 (VB6) is a programming language and integrated development environment (IDE) used to create software applications for the Microsoft Windows operating system. It is commonly used for developing graphical user interface (GUI) programs.

2. What is a trigonometric value?

A trigonometric value is a value that represents the ratio of two sides of a right triangle in relation to one of its acute angles. The most common trigonometric values are sine, cosine, and tangent.

3. How do I use Basic Visual 6 to calculate trigonometric values?

To calculate trigonometric values in Basic Visual 6, you can use the built-in functions such as Sin, Cos, and Tan. These functions take an angle in radians as input and return the corresponding trigonometric value. You can also use the ArcSin, ArcCos, and ArcTan functions to calculate the inverse trigonometric values.

4. Can I create a simple program for calculating trigonometric values in Basic Visual 6?

Yes, you can create a simple program for calculating trigonometric values using Basic Visual 6. You will need to use the appropriate trigonometric functions and input the desired angle from the user. You can also add additional features such as error handling and a user-friendly interface to make the program more robust.

5. Are there any resources available to learn more about Basic Visual 6 and trigonometric calculations?

Yes, there are many online tutorials, forums, and documentation available to help you learn Basic Visual 6 and trigonometric calculations. You can also refer to books and online courses specifically designed for learning Basic Visual 6 and trigonometry. It is recommended to practice and experiment with the language to gain a better understanding.

Similar threads

Replies
4
Views
3K
  • Programming and Computer Science
Replies
2
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
8
Views
1K
Back
Top