Show Value in Lable RunTime in windows Form

Posted by Nksingh420 under C# on 8/23/2012 | Points: 10 | Views : 1175 | Status : [Member] | Replies : 5
I want to show Username in Label but i don't know how many Username in Database.
So how to create run time Label ....




Responses

Posted by: Pava on: 8/23/2012 [Member] Starter | Points: 25

Up
0
Down
save the current user name (loged in user name)in session variable or cokiie .assaign that to label.

Nksingh420, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Nksingh420 on: 8/23/2012 [Member] Starter | Points: 25

Up
0
Down
@Pava
i want to show all username at the same time in label
but problem is that we don't know how many username in a database example: 8 ,9,10....

Nksingh420, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Gopesh9 on: 8/24/2012 [Member] Starter | Points: 25

Up
0
Down
Use For loop and then dynamically create the object of Label and then add it to the Panel
Label l = new Label();

l.Text = UserName;
Panel1.AddControls(l);


G. S.
.Net Developer

Nksingh420, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Nksingh420 on: 8/24/2012 [Member] Starter | Points: 25

Up
0
Down
can u send me code in my mail id ....

neerajkrsingh88@gmail.com

Nksingh420, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Shanky11 on: 8/24/2012 [Member] Starter | Points: 25

Up
0
Down
Label l1=new Label();
l1.Text="shankar";
sam1.Location=new Point(30,30);
this.Controls.Add(l1);

Nksingh420, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response