If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Visual Basic > Help Needed in Visual Basic 2008 coding

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-03-09, 00:04
NaeNae1021 NaeNae1021 is offline
Registered User
 
Join Date: Aug 2009
Posts: 2
Help Needed in Visual Basic 2008 coding

I have a problem (this is for school), and I am stuck. This is from a similar post back from March, on the pythagorean Theorum or Cylinder Volume. I have the code entered and have no errors, but the only thing is when I run the calculate button when debugging, no matter what the numericUpDown buttons show, 1, 2, or 5 etc, my txtResult box still reflects 0. Can somebody please tell me what I am missing from my code? I'm so close I can almost taste it.
here is what I have so far on the calculate button:
Code:
 Private Sub BtnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnCalculate.Click
        System.Convert.ToString(TxtResults.Text)



        'step 1 - get input value from user
        '   1a - get the value of A, or radius
        Dim NUDRadOrDimA As Integer
        Dim NudHeightOrB As Integer

        '   1b - get the value of B, or the height
        'step 2 - define the needed variables to the input values


        'step 3 - determine which radio button was selected

        If RdPythagorean.Checked Then
            System.Math.Sqrt(NUDRadOrDimA ^ 2 + NudHeightOrB ^ 2)
            'pythagorean Theorem calculation
            'A^2 + B^2 = the length of the angle in the triangle (C^2)
            '= pythagorean theorem
            TxtResults.Text = (NUDRadOrDimA ^ 2 + NudHeightOrB ^ 2)

        End If

        If RdCylinder.Checked Then

            'Cylinder volume calculation
            'pi * (radius^2) * height = volume of a cylinder
            '= cylinder volume
            TxtResults.Text = (3.14 * ((NUDRadOrDimA ^ 2) * NUDHeightOrB))
        End If
        'step 4 - calculate the value based on above

        'step 5 - display the output


    End Sub
I appreciate any suggestions.

Thank you
Renee

Last edited by loquin; 08-06-09 at 18:47. Reason: add code tags for readability
Reply With Quote
  #2 (permalink)  
Old 08-03-09, 02:00
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,262
well this doens't seem to beanythign to do with databases, so I suspect you will be better off asking this sort of question in the sister forum to this site programming talk.. its the last forum on the front page.

however it looks to me as if you dont assign a value to the variables NUDRadOrDimA & NudHeightOrB. there is no reference I can see to numeric up and down controls you suggest in your question. so I'm guessing that is your problem.
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton

Last edited by healdem; 08-03-09 at 02:10.
Reply With Quote
  #3 (permalink)  
Old 08-03-09, 11:52
NaeNae1021 NaeNae1021 is offline
Registered User
 
Join Date: Aug 2009
Posts: 2
thank you for the guideance. I am new to this stuff, forums as well as programming.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On