Guest hua bang Posted September 29, 2010 Share Posted September 29, 2010 i did like below <script runat="server"> Sub submithe11(ByVal sender As Object, ByVal e As EventArgs) TextBox11.Text = TextBox1.Text TextBox16.Text = TextBox1.Text TextBox66.Text = TextBox1.Text TextBox61.Text = TextBox1.Text End Sub<\script> and 1 button for after click then the value from textbox1 will send to textbox11,16,66,61 (i have 100textbox). I want to ask if some body know how to add value, because if i put 500 in textbox1 and click then all those textboxs will have value is 500, i want in second time click( or third) the value will be add, that mean it s sum. fisrt time i put 500 the second time i put 300 in those textbox will have value is 800 , not the last value, mrhua@ovi.com thank you Link to comment Share on other sites More sharing options...
shaffiq_fiq88 Posted February 18, 2011 Share Posted February 18, 2011 It is quite a long script to do that. In VBScript, it is long but simple than VBScript.NET.To add, just use addition operator (+). ' This is VBScriptSub Calc()Box1 = document.getElementByID(txtBox1).valueBox2 = document.getElementByID(txtBox2).valueBox3 = document.getElementByID(txtBox3).valuedocument.getElementByID(txtBox2).value = Box2+Box1document.getElementByID(txtBox3).value = Box3+Box1End Sub Above script is VBScript but what you implement is VBScript.NET ' This is VBScript.NET' Not a true code. Just give you an idea.Sub Calc(ByVal s As Object, ByVal e As EventArgs) Handles.Button1Box1 As Integer = dtxtBox1.textBox2 As Integer = dtxtBox2.textBox3 As Integer = dtxtBox3.textdtxtBox2.text = Box2+Box1dtxtBox3.text = Box3+Box1End Sub To make it simple, make a class library. Public Class Calculation Public Property Data(MyData As Something) Get End Get Set End Set End Property Public Sub Calc() End SubEnd Class This post should be moved to .NET forum. Not to post here. Good luck. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.