Click here to Skip to main content
15,910,872 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Object Required: WScript Pin
Anoop Brijmohun7-May-09 21:55
Anoop Brijmohun7-May-09 21:55 
GeneralRe: Object Required: WScript Pin
Noctris8-May-09 0:09
Noctris8-May-09 0:09 
GeneralRe: Object Required: WScript Pin
Dave Kreskowiak8-May-09 0:41
mveDave Kreskowiak8-May-09 0:41 
QuestionHelp - a Different sort of Triangle Value Calculation Pin
cyndy_northrup7-May-09 18:05
cyndy_northrup7-May-09 18:05 
AnswerRe: Help - a Different sort of Triangle Value Calculation Pin
Dalek Dave7-May-09 21:25
professionalDalek Dave7-May-09 21:25 
GeneralRe: Help - a Different sort of Triangle Value Calculation Pin
cyndy_northrup8-May-09 10:18
cyndy_northrup8-May-09 10:18 
QuestionRe: Help - a Different sort of Triangle Value Calculation Pin
cyndy_northrup8-May-09 22:05
cyndy_northrup8-May-09 22:05 
QuestionHELP - Hypotenuse and Angle B Error Pin
cyndy_northrup7-May-09 18:04
cyndy_northrup7-May-09 18:04 
If you only know two side lengths of a scalene triangle (but none of the angles) can you determine the third side length?


I had been using this formula to determine the length of the hypotenuse ;

SQRT ( side1^2 + side2^2)

But realized that this is meant ONLY to determine the side length of the hypotenuse for right triangles and not scalenes per se.... is there some other formla that can be used to get the line length of the hypotenuse for a scalene in the above situation?

If there isn't a way to get the 3rd line length of scalenes this way, do you know if there is a way to get the hypotenuse line length AND the angle between the hypotenuse and the base, if we have the two side lengths of the base(adjacent) and the opposite side, and if we have the associated angles for these sides?


I've tried to incorporate all I've learned so far... but I keep getting weird errors and as far as I can tell all my formulas are correct?

I've built a small VB program, am including a sample below and the critical formulas and code I'm using... if any one can shed some light on where I've gone wrong it would be so nice! Smile | :)
( I'm using VB 4.0 and can't upgrade right now so I have to work within that limitation)


Here is an example ;

Accept input from three text entry boxes

1.) Value for Side (a), Adjacent Base
the value of 14 is entered

2.) Value for Side (c), Opposite
the value of 10 is entered

3.) Angle (B) [ entered as degrees ]
the value of 60 degrees is entered

The hypotenuse is computed to be ;
8.83176086632785

The arc cos function is derived ;

Public Function Arccos(X As Double) As Double
Arccos = Atn(-X / Sqr(-X * X + 1)) + 2 * Atn(1)
End Function

Its then called from code below

Pi is declared as a constant in a module
'=======================
'=======================

'Converts the entry from degrees to radians

angle_B_degree_value_radians = (angle_B_degree_value * Pi) / 180

'get hypotenuse side length and outputs it to a text box
side_b_squared = CDbl(c1 ^ 2 + a1 ^ 2 - (c1 * a1)) * Cos(angle_B_degree_value_radians)

b1 = Sqr(side_b_squared)
Text5.Text = b1

angle_C_cos_value = CDbl(a1 ^ 2 + b1 ^ 2 - c1 ^ 2) / (2 * (a1 * b1))

angle_B_cos_value = CDbl(c1 ^ 2 + a1 ^ 2 - b1 ^ 2) / (2 * (c1 * a1))

angle_A_cos_value = CDbl(b1 ^ 2 + c1 ^ 2 - a1 ^ 2) / (2 * (b1 * c1))

angle_C_acos_value = (Arccos(angle_C_cos_value))

angle_B_acos_value = (Arccos(angle_B_cos_value))

angle_A_acos_value = (Arccos(angle_A_cos_value))


angle_C_degree_value = angle_C_acos_value * 180 / Pi

angle_B_degree_value = angle_B_acos_value * 180 / Pi

angle_A_degree_value = angle_A_acos_value * 180 / Pi

'=======================
'=======================

The problem is, that

angle_B_Degree Value 38.8700377933938

is returned as a degree value very different from what I entered ( 60 ) degrees! I wanted to recompute this angle to confirm that it was working ok.... but it seems often off, so now I dont know how valid any of my calculations are! I don't understand why this is happening?

I've also tried entering angles different from 60 degrees but with the samed side length values, for instance if I enter 90 degrees or 120 degrees it jus automatically fails.... if I enter 80 degrees I also get an error back....?
AnswerRe: HELP - Hypotenuse and Angle B Error Pin
Dalek Dave7-May-09 21:19
professionalDalek Dave7-May-09 21:19 
GeneralRe: HELP - Hypotenuse and Angle B Error Pin
cyndy_northrup8-May-09 10:11
cyndy_northrup8-May-09 10:11 
AnswerRe: HELP - Hypotenuse and Angle B Error Pin
Dave Kreskowiak8-May-09 0:35
mveDave Kreskowiak8-May-09 0:35 
QuestionCombo displaying font Pin
Ric70247-May-09 11:15
Ric70247-May-09 11:15 
AnswerRe: Combo displaying font Pin
Dave Kreskowiak7-May-09 14:30
mveDave Kreskowiak7-May-09 14:30 
AnswerRe: Combo displaying font Pin
DidiKunz8-May-09 1:31
DidiKunz8-May-09 1:31 
QuestionUsing print spooler to update shared log file Pin
Roy Barkas7-May-09 11:15
Roy Barkas7-May-09 11:15 
AnswerRe: Using print spooler to update shared log file Pin
Dave Kreskowiak7-May-09 14:28
mveDave Kreskowiak7-May-09 14:28 
GeneralRe: Using print spooler to update shared log file Pin
Roy Barkas7-May-09 21:48
Roy Barkas7-May-09 21:48 
GeneralRe: Using print spooler to update shared log file Pin
Dave Kreskowiak8-May-09 0:31
mveDave Kreskowiak8-May-09 0:31 
Questiondatatype conversion problem when fetching fromn database Pin
Ankit Aneja7-May-09 7:42
Ankit Aneja7-May-09 7:42 
AnswerRe: datatype conversion problem when fetching fromn database Pin
Dave Kreskowiak7-May-09 10:00
mveDave Kreskowiak7-May-09 10:00 
GeneralRe: datatype conversion problem when fetching fromn database Pin
Ankit Aneja7-May-09 11:02
Ankit Aneja7-May-09 11:02 
QuestionRAS option RASEO_RequireDataEncryption not work Pin
xmen3317-May-09 5:33
xmen3317-May-09 5:33 
AnswerRe: RAS option RASEO_RequireDataEncryption not work Pin
Dave Kreskowiak7-May-09 6:03
mveDave Kreskowiak7-May-09 6:03 
QuestionOpen all files in a Folder Pin
vijay24827-May-09 5:05
vijay24827-May-09 5:05 
AnswerRe: Open all files in a Folder Pin
Dave Kreskowiak7-May-09 5:32
mveDave Kreskowiak7-May-09 5:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.