Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to load a textbox?

Status
Not open for further replies.

onechuck

IS-IT--Management
Feb 14, 2006
79
US
I'm very new to C#. I have this code in VB:

Protected Sub txtSummary_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtSummary.Load
Dim strSummary As String

strSummary = txtFstName.Text & " " & txtLstName.Text

End Sub

How do I do exactly like this in C#?
 
Make your page_load event or your form constructor fill this code in for you.

private string strSummary;

public Form1()
{
InitializeComponents();

strSummary = txtFstName.Text + " " + txtLstName.Text;
}
 
Thanks for the help. The txtSummary is a textbox I created in my .aspx file. How do I add the txtSummmary_Load to the event handler in design time?
 
Never mind, I got it working. Thanks! I forgot to put OnLoad. In VB.NET it never asked me but in C# it will not work...so I found out.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top