How to setup a sub this way

  • Thread starter Thread starter Elmo Watson
  • Start date Start date
E

Elmo Watson

first off - let me say that I'm not using VS.Net - all Inline coding ....

I have a form (using tabstrip) that has a couple of sections - -
CustInfo
BillingCustInfo

I want the name, address, etc to be duplicated from the Custinfo section, to
the Billing Section automatically, for each field....(naturally, allowing
editing at a later point, when necessary)

SO - I added a Subroutine, to do this using the onTextChanged Event, when
the textbox loses focus:

Sub doTextChange(sFrom as TextBox, sTo as TextBox)
sTo.Text=sFrom.Text
End Sub

Then, - thinking more simply than I should, adding:
OnTextChanged="doTextChanged(txtCustName, txtBLNGCustName)"

however, I get the following error:
Sub doTextChange(sFrom As System.Web.UI.WebControls.TextBox, sTo As
System.Web.UI.WebControls.TextBox)'
does not have the same signature as delegate 'Delegate Sub
EventHandler(sender As Object, e As System.EventArgs)'

If figured this would be an easy way to populate sections, field by field,
with minimal coding - - but I guess I was wrong
Can someone help me learn what it takes to get something like this working?
 
the error message is telling you that the text changed event actually
expects parameters of type object and EventArgs

eg

sub txt_changes(sender as object, e as EventArgs)
txtto.text = txtfrom.text
end sub

OnTextChanged="doTextChanged(txtCustName, txtBLNGCustName)" will not
hook up the event - instead specify the event in the server tag
<asp:textbox id='txtto' runat='server' ontextchanged='txt_changes'
autopostback='true' />

have a look here for some good basic
informationhttp://www.w3schools.com/aspnet/aspnet_textbox.asp

also consider javascript for this type of thing, it will be more
efficient as no server round trip will be required...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top