Welcome to Dream.In.Code
Getting VB.NET Help is Easy!

Join 132,214 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 945 people online right now. Registration is fast and FREE... Join Now!




I Need Help

 
Reply to this topicStart new topic

I Need Help

dvon2008
post 22 Feb, 2008 - 09:25 AM
Post #1


New D.I.C Head

*
Joined: 27 Nov, 2007
Posts: 18


My Contributions


When i hit the find button the initialTemperatureTB, the finalTemperatureTB, the massTB, and the energyTB all go to zero no matter what i put in them.
CODE
Public Class Form1

    Dim Element As String
    Dim BP As Single
    Dim FP As Single
    Dim CP As Single
    Dim HF As Single
    Dim HV As Single
    Dim TI As Single
    Dim TF As Single
    Dim M As Single
    Dim Var1 As Single
    Dim Var2 As Single
    Dim Var3 As Single
    Dim Var4 As Single
    Dim Var5 As Single
    Dim Var6 As Single
    Dim Var7 As Single
    Dim Var8 As Single
    Dim Var9 As Single
    Dim Var10 As Single
    Dim EN As Single

    Private Sub findButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles findButton.Click

        Element = elementTB.Text.ToUpper()

        Select Case Element
            Case "ACTINIUM"
                BP = 3300
                FP = 1050
                CP = 0.12
                HV = 293
                HF = 14.3
            Case "ALUMINUM"
                BP = 2517.6
                FP = 660.37
                CP = 0.9025
                HV = 290.8
                HF = 10.71
            Case "AMERICIUM"
                BP = 2600
                FP = 994
                CP = 238.5
                HV = 10
                HF = 0
            Case "ANTIMONY"
                BP = 1635
                FP = 630.7
                CP = 0.2072
                HV = 193
                HF = 19.5
            Case "ARGON"
                BP = -185.86
                FP = -189.37
                CP = 0.52033
                HV = 6.52
                HF = 1.18
            Case "ARSENIC"
                BP = 615
                FP = 816
                CP = 0.3289
                HV = 0
                HF = 27.7
            Case "ASTATINE"
                BP = 350
                FP = 300
                CP = 0
                HV = 90.3
                HF = 23.8
            Case "BARIUM"
                BP = 1845
                FP = 726.9
                CP = 0.2044
                HV = 140
                HF = 8.012
            Case "BERKELIUM"
                BP = 0
                FP = 986
                CP = 0
                HV = 0
                HF = 0
            Case "BERYLLIUM"
                BP = 2468
                FP = 1287
                CP = 1.824
                HV = 297.6
                HF = 7.895
            Case "BISMUTH"
                BP = 1564
                FP = 271.4
                CP = 0.1221
                HV = 179
                HF = 10.9
            Case "BORON"
                BP = 3868
                FP = 2080
                CP = 1.026
                HV = 504.5
                HF = 50.2
            Case "BROMINE"
                BP = 59.35
                FP = -7.25
                CP = 0.47362
                HV = 29.56
                HF = 10.571
            Case "CADMIUM"
                BP = 770
                FP = 320.8
                CP = 0.2311
                HV = 100
                HF = 6.19
            Case "CALCIUM"
                BP = 1500.5
                FP = 841.5
                CP = 0.6315
                HV = 155
                HF = 8.54
            Case "CALIFORNIUM"
                BP = 0
                FP = 900
                CP = 0
                HV = 0
                HF = 0
            Case "CARBON"
                BP = 4200
                FP = 3620
                CP = 0.7099
                HV = 711
                HF = 104.6
            Case "CERIUM"
                BP = 3470
                FP = 804
                CP = 0.1923
                HV = 313
                HF = 5.2
            Case "CESIUM"
                BP = 674.8
                FP = 28.4
                CP = 0.2421
                HV = 67
                HF = 2.087
            Case "CHLORINE"
                BP = -34
                FP = -101
                CP = 0.4782
                HV = 20.41
                HF = 6.41
            Case "CHROMIUM"
                BP = 2679
                FP = 1860
                CP = 0.4491
                HV = 339
                HF = 16.192
            Case "COBALT"
                BP = 2912
                FP = 1495
                CP = 0.421
                HV = 382
                HF = 13.38
            Case "COPPER"
                BP = 2570
                FP = 1085
                CP = 0.38452
                HV = 304
                HF = 0
            Case "CURIUM"
                BP = 3540
                FP = 1340
                CP = 0
                HV = 0
                HF = 0
            Case "DYSPROSIUM"
                BP = 2600
                FP = 1407
                CP = 0.1733
                HV = 250
                HF = 10.4
            Case "EINSTEINIUM"
                BP = 0
                FP = 860
                CP = 0
                HV = 0
                HF = 0
            Case "ERBIUM"
                BP = 2900
                FP = 1497
                CP = 0.1681
                HV = 293
                HF = 17.2
            Case "EUROPIAN"
                BP = 1439
                FP = 826
                CP = 0.182
                HV = 176
                HF = 10.5
            Case "FERMIUM"
                BP = 0
                FP = 0
                CP = 0
                HV = 0
                HF = 0
            Case "FLUORINE"
                BP = -188.2
                FP = -219.7
                CP = 0.8238
                HV = 6.54
                HF = 0.51
            Case "FRANCIUM"
                BP = 650
                FP = 24
                CP = 0
                HV = 63.6
                HF = 2
            Case "GADOLINIUM"
                BP = 3000
                FP = 1312
                CP = 0.2355
                HV = 311.7
                HF = 15.5
            Case "GALLIUM"
                BP = 2203
                FP = 29.77
                CP = 0.3709
                HV = 256
                HF = 5.59
            Case "GERMANIUM"
                BP = 2850
                FP = 945
                CP = 0.3215
                HV = 334.3
                HF = 31.8
            Case Else
                MessageBox.Show("This is Not an Element", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information)
        End Select

        boilingPointLabel.Text = BP.ToString
        freezingPointLabel.Text = FP.ToString
        heatFusionLabel.Text = HF.ToString
        heatVaporizationLabel.Text = HV.ToString
        specificHeatLabel.Text = CP.ToString
    initialTemperatureTB.text = TI.tostring
    finalTemperatureTB.text = TF.tostring
    massTB.text = M.tostring


        If TI < FP Then
            Var1 = M * (FP - TI) * CP
        Else
            Var1 = 0
        End If
        If TI < FP AndAlso TF > FP Then
            Var2 = M * HF
        Else
            Var2 = 0
        End If
        If TI < FP AndAlso TF > BP Then
            Var3 = M * (BP - FP) * CP
        Else
            Var3 = 0
        End If
        If TI > FP AndAlso TF > BP Then
            Var4 = M * (BP - TI) * CP
        Else
            Var4 = 0
        End If
        If TI > FP AndAlso TF < BP Then
            Var5 = M * (TF - TI) * CP
        Else
            Var5 = 0
        End If
        If TI < BP AndAlso TF > BP Then
            Var6 = M * HV
        Else
            Var6 = 0
        End If
        If TI < BP AndAlso TF > BP Then
            Var7 = M * (TF - BP) * CP
        Else
            Var7 = 0
        End If
        If TI > BP AndAlso TF > BP Then
            Var8 = M * (TF - TI) * CP
        Else
            Var8 = 0
        End If
        If TI < FP AndAlso TF < FP Then
            Var10 = M * (TF - TI) * CP
        Else
            Var10 = 0
        End If
        energyLabel.Text = Var1 + Var2 + Var3 + Var4 + Var5 + Var6 + Var7 + Var8
    

           End Sub
End Class


The energyLabel not the energyTB Sorry!
User is offlineProfile CardPM

Go to the top of the page

PsychoCoder
post 22 Feb, 2008 - 10:32 AM
Post #2


using DIC.Core;

Group Icon
Joined: 26 Jul, 2007
Posts: 8,923



Thanked 117 times

Dream Kudos: 8475

Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions


Moved to VB.Net smile.gif
User is online!Profile CardPM

Go to the top of the page

bflosabre91
post 22 Feb, 2008 - 12:21 PM
Post #3


D.I.C Head

**
Joined: 22 Feb, 2008
Posts: 201


My Contributions


put a breakpoint in the case statement where the variable should be assigned a variable. it seems its not running that correctly
User is offlineProfile CardPM

Go to the top of the page

PsychoCoder
post 22 Feb, 2008 - 12:26 PM
Post #4


using DIC.Core;

Group Icon
Joined: 26 Jul, 2007
Posts: 8,923



Thanked 117 times

Dream Kudos: 8475

Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions


I would start by changing to a double data type since you're using decimal values as well
User is online!Profile CardPM

Go to the top of the page

dvon2008
post 23 Feb, 2008 - 06:00 PM
Post #5


New D.I.C Head

*
Joined: 27 Nov, 2007
Posts: 18


My Contributions


what do you mean
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/21/08 08:22PM

Live VB.NET Help!

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month