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...
SQL
Normal
0falsefalsefalse
EN-US
X-NONE
AR-SA
Protected Sub calculatememButton_Click(ByVal
sender As Object,
ByVal e As
System.EventArgs) Handles
calculatememButton.Click
Dim
E_member AsDouble
Dim
W_member AsDouble
Dim
E_result As String
Dim
w_result As String
Dim
e_factor AsDouble
Dim
w_factor AsDouble
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")) =FalseThen
E_result_mem_lbl.Text = " * The value you've entered is: ( "
& E_member & " ) and this value
represents your Electrecity consumption rate for building 1.
* Your Electricity carbon footprint is: (" &
E_result & ") Metric Tons."
ElseIf
IsDBNull(objReader("E_result")) =TrueThen
W_result_mem_lbl.Text = "* The value you've entered is: ( "
& W_member & " ) and this value
represents your Water consumption rate for building 1.
* Your water carbon footprint is: ("
& w_result & ") Metric tons."
Else
Response.Write.("")
End If
End Sub
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Justin Andrews5 reputationPosted May 10, 2010, 7:26 AM EDT
0
Have you considered storing your results to a list?
In C# I would declare a private class level variable List _myStringList = new List(); and each time the user enter a value (inside click event) I would add the item to my list... _myStringList.add("my new string value");
Justin Andrews5 reputationPosted May 10, 2010, 7:26 AM EDT
In C# I would declare a private class level variable List
Ayesha balooshi18 reputationPosted May 11, 2010, 12:04 AM EDT
I'm using VB , not C# ....
so that am not aware if that option is possible and am just a beginner I don't know how to use such a thing.