Click here to Skip to main content
15,899,754 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi friends
i want in my form appear a label for just a moment so disappear it.
please guide me
Posted

Once your page loads call a function to:

- setTimeout("$('#labelId').hide();", 1000);
or
- setTimeout("document.getElementById('labelId').style.display='none';", 1000);

see here:

http://www.w3schools.com/js/js_timing.asp[^]
 
Share this answer
 
Comments
#realJSOP 8-Sep-11 8:23am    
He didn't say anything about this being on a web page.
C#
label1.Visible = true;
Thread.Sleep(500);
label1.Visible = false;

Of course, I would do this with a Timer, a Thread, or a BackgroundWorker object, but the code above will do exactly what I think it is that you're asking (given the amount of info provided in your question).
 
Share this answer
 
v2
I think,You are talking about,Windows Forms.
try this! hope it helps
C#
lblMsg.Text="Your Message";
for(int i=0;i<50000;i++);
lblMsg.Text="";
 
Share this answer
 
I'd try deleting the control via timer event:

C#
public class ParentingControl
{
    System.Windows.Forms.Label shortLivedLabel = new Label();
    System.Windows.Forms.Timer labelKiller = new Timer();

    override void OnLoad(object sender, EventArgs e)
    {
        shortLivedLabel.Location = new Point(Wherever you want it to be);
        shortLivedLabel.Size = new Size(Whatever size);
        shortLivedLabel.Text = "Whatever text there should be";

        labelKiller.Interval = How long you want it to exist.
        labelKiller.Tick += new EventHandler(labelKiller_Tick);

        this.Controls.Add(shortLivedLabel);
        labelKiller.Start();
    }


    private void labelKiller_Tick(object sender, EventArgs e)
    {
        labelKiller.Stop();
        this.Controls.Remove(shortLivedLabel);
    }
}
Or, if you prefer, you could Show() and Hide() the label when appropriate.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900