MissCoffee
New Member
dim x<BR><BR>sub page_load<BR>if not isPageLoad then<BR>x=5<BR>end if<BR>end sub<BR><BR>sub clickB<BR>x = x + Convert.toInt32(tx.Text)<BR>end sub<BR><BR><asp:textbox id="tx" runat="server"/><BR><asp:button id="bt" runat="server" onclick="clickB"/><BR><BR><BR>--------<BR><BR>In the above types of code how do i accomplish x to print 15 if i enter 10 in the textbox. What is hapennig now is im getting 5 all the time.<BR><BR>If I declare x inside page_load's if loop then its not being recognized inside clickB routine.<BR><BR>how to do this.If you want a variable to be accessable for all sub routines in the <SCRIPT runat="server"> tags, just declare it outside of the sub's like this:<BR><BR><SCRIPT Runat="Server"><BR>Dim X As Integer<BR><BR>Sub Whatever()<BR> Do stuff bla bla<BR>End Sub<BR><BR><BR></SCRIPT><BR>thats waht i did; but it is resetting its (X's) value everytime i call Whatever() routine. My guess is that it is getting declared or reset again.You are not setting the text of the tx textbox anywhere<BR><BR>Try This:<BR>sub clickB<BR>x = x + Convert.toInt32(tx.Text)<BR>tx.Text = x<BR>end sub