Ayesha balooshi

Ayesha balooshi

  • NA
  • 18
  • 28.2k

Calculation Code

May 10 2010 10:53 AM
am using form that  calculates the water footprint based on the consumption rate that the user enters ... similar is applied for electricity footprint.

the form uses the figures which is in the text box to multiply it to the factor which is saved in the drop down list ...

the result should be saved in the label

this process is easy and straightforward
however i want to let the user to reenter the same figures for example if he wants to add more than one buildings (water and electricity)

what could be done so that the first result is saved in label 1

and the other result which the user will re enter the consumption...





 

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

 

        Dim E_member As Double

        Dim W_member As Double

        Dim E_result As String

        Dim w_result As String

        Dim e_factor As Double

        Dim w_factor As Double

 

        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

        w_result = W_member * w_factor

 

 

        If IsDBNull(objReader("E_result")) = False Then

            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."

        ElseIf

            IsDBNull(objReader("E_result")) = True Then

            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."

        Else

            Response.Write.("")

        End If

 

 

    End Sub



Answers (2)