Reference?

  • Thread starter Thread starter ll
  • Start date Start date
L

ll

Hi,

I have a text web control called "UserID".

and I define a function like this:
Private int GetUserName(int UserID)
{
string sql = "select * from users where UserID = " + UserID;
ADO.Execute...
How to assign the UserID to the TextControl(UserID)?
UserID.Value = UserID???
}

Question:
How to assign the UserID to the TextControl(UserID)?

Thanks.
 
How to assign the UserID to the TextControl(UserID)?

If your TextBox is named txtUserID, then you would do:

txtUserID.Text = UserId.ToString();

Hope that helps,
-JG
 
Thanks Juan.
I have changed that.
But I want to know another way around(can keep them the same name)?
 
Thanks Juan.
I have changed that.
But I want to know another way around(can keep them the same name)?

Another way around? What do you mean by "keep the same name?"

-JG
 
| From: "ll" <[email protected]>
|
| Hi,
|
| I have a text web control called "UserID".
|
| and I define a function like this:
| Private int GetUserName(int UserID)
| {
| string sql = "select * from users where UserID = " + UserID;
| ADO.Execute...
| How to assign the UserID to the TextControl(UserID)?
| UserID.Value = UserID???
| }
|
| Question:
| How to assign the UserID to the TextControl(UserID)?
|
| Thanks.

If a memeber variable's name is shadowed by another variable with the same
name, you can access the member variable with the "this." prefix.

In your case, you could write:

this.UserID.Value = UserID;

- Zhanyong Wan

Visual Studio and .NET Setup

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included samples (if any) is subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
 

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