Ayesha balooshi

Ayesha balooshi

  • NA
  • 18
  • 28.2k

calculation result Code ... "IMPORTANT"

May 6 2010 5:50 AM
Good afternoon

i have a question and your help is needed :)

can any one help me in the matter?

I have a calculation form withe calculatememButton button in it. what i actually want is letting the user to enter the values which are the consumption rate for both electricity in water and if he wants to add more buildings (electricity and water consumption to be added again) .. the form got cleared and the user is giving the option to add a new building which the results will be saved in another label ...
firstly I've declared the variables and assigned the text boxes to them and then didnt knwo what to do so that i added a new label and re declared the same variables in a different name ...

the problem is am getting the same result in both labels which means users enter 1 consumption rate and its treating it as 2...






Protected Sub calculatememButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles calculatememButton.Click



            Dim E_member As String
            Dim W_member As String
            Dim E_result As String
            Dim w_result As String
            Dim e_factor As String
            Dim w_factor As String

            E_member = electricitytxtmem.Text
            W_member = watertxtmem.Text
            E_result = E_result_mem_lbl.Text
            w_result = W_result_mem_lbl.Text
            e_factor = e_mem_f_DropDownList.Text
            w_factor = W_mem_f_DropDownList.Text

            E_result = E_member * e_factor
            E_result_mem_lbl.Text = " * The value you've entered is: ( " & E_member & " ) and this value represents your Electrecity consumption rate for building 1. <br> <br> * Your Electricity carbon footprint is: (" & E_result & ") Metric Tons."

            w_result = W_member * w_factor

            W_result_mem_lbl.Text = "* The value you've entered is: ( " & W_member & " ) and this value represents your Water consumption rate for building 1.  <br> <br>   * Your water carbon footprint is: (" & w_result & ") Metric tons."


            Dim E_member2 As String
            Dim W_member2 As String
            Dim e_factor2 As String
            Dim w_factor2 As String
            Dim E_result2 As String
            Dim w_result2 As String

            E_member2 = electricitytxtmem.Text
            W_member2 = watertxtmem.Text
            E_result2 = E_result_mem_lbl1.Text
            w_result2 = W_result_mem_lbl1.Text
            e_factor2 = e_mem_f_DropDownList.Text
            w_factor2 = W_mem_f_DropDownList.Text

            E_result2 = E_member2 * e_factor2

            E_result_mem_lbl1.Text = " * The value you've entered is: ( " & E_member2 & " ) and this value represents your Electrecity consumption rate for building 2. <br> <br> * Your Electricity carbon footprint is: (" & E_result2 & ") Metric Tons."

            w_result2 = W_member2 * w_factor2

            W_result_mem_lbl1.Text = "* The value you've entered is: ( " & W_member2 & " ) and this value represents your Water consumption rate for building 2.  <br> <br>   * Your water carbon footprint is: (" & w_result2 & ") Metric tons."

            electricitytxtmem.Text = ""
            watertxtmem.Text = ""

    End Sub


this was my code .. can you help me in it ASAP?! ,,,