im using windows form application..using c# . i have a label that displays some text when i click a buttom. now i want the label to display its text only for 10 seconds and later it should get disabled.
You will need to use a Timer, set it to 10 seconds when the form loads (or whenever you need it to).
In the timer Tick event, you can disable the label control (or set its text to string.Empty, or whatever you need). You will also need to stop the timer at that point, or it will keep firing every 10 seconds.
there is a control name timer.you can find it in toolbox use that control and set time in it and assign a work in its code body.it will work
here is the link
http://msdn.microsoft.com/en-us/library/system.windows.forms.timer.aspx
If you got solution from my answer then click my answer and vote me.thanx
Take a look at Timer class examples in here.
Related
I want to set my wpf application to navigate to another page after 3 second using c#.
Is this possible? If yes then how?
You could either use a Timer and set the Tick to 3000 which would a fire a method, changing the page. Or you could start a new Thread, put a thread.sleep(3000) then call the page change. If you do the second method, you need to use Dispatcher.Invoke as you are not on the main UI thread.
I want to show a popup window for few seconds to greet users on their desktop.
it should be non-interactive.i want to do this in c# ,winform or wpf.
For example,
After user logged in, For every 3 hours , “Hello” message Should be shown for a second, then auto hide.
can anyone give some ideas.
thanks
In WPF:
Use Popup control to display your "Hello".
In the application, to set up recurring popup display and close, set up an instance of System.Windows.Threading.DispatcherTimer Class.
Create a form to display whatever message you want, size it however you feel. But a timer on it for 3 seconds that will do form.close() when the timer expires.
when your app loads, have it display the form.
I have a WinForms application that, at some point, will do some calculations that take a couple of seconds. During this time, I disable the controls. Additionally I want to display a popup that kind of 'blocks' the application more visibly.
I tried placing a Panel on top of the Form in order to do so, but there I'm somehow not able to add any text to it. I.e. the Labels and ImageBoxes I put there are somehow not displayed or behind the Panel.
Any suggestions how I could achieve this in a quick and easy way? .. I mean, without redesigning the whole Form.
Your problem with the things not showing up in your additional panel is that everything is happening in the same thread, but your calculations are blocking everything from appearing because they are hogging up the thread. You should look into using a backgroundWorker, which is one of the tools in WinForms. You should throw the function call that performs the calculations into the DoWork method of the backgroundWorker, then the form itself can continue to function during the calculations.
See http://msdn.microsoft.com/en-us/library/cc221403%28v=vs.95%29.aspx for examples
Create a Dialog Box (windows form) to popup during the processing, then you can have the Dialog Box close once your processing is completed.
By using a Dialog Box not a Message Box, you can still have control over closing the window when your processing is done.
You could create a simple UserControl with just a Label and an ImageBox, maybe with public setter for their values. You can add it to your form setting its Visible property to false. Then you can make it visible during your calculations and go back top invisible in the end.
I am coding a system which has a small FTP module included inside, it's not the main feature at all, but needed...
I must link the progressbar with the WebClient class event DownloadProgressChangedEventHandler and AsyncCompletedEventHandler, the progressbar increment is ok, and the ASyncCompletedEventHandler launch a MessageBox (as intended), the problem is that the progress bar see to load too slow...
problem :
My MessageBox pop at 100% (launched by the event handler), BUT when the MessageBox pop my progress bar is only at +-80% (but the .VALUE is really 100), the first though I had was that they have added a "smooth" effect in Windows Vista which slow down the progressbar relatively to it's true value.
If any of you have experienced the same problem thanks for your help.
For those of you who want to know, Vista actually add a "smoothing" to the loadingbar change, it look like the "Tweening effect" of Flash.
I tried on Windows XP and the bar reach 100% exactly when the value reach 100. On Vista it look like they have decided that the "loading" would be splitted over a delay X.
Before you display your message box, call Application.DoEvents() to force all the pending Windows queued messages to be processed. Your progress bar is probably not getting a chance to paint itself one last time before the message box displays.
Why not simply set the progress bar value to 100% on the same DownloadProgressChangedEventHandler event handler that displays the message box?
I've some questions .. and I really need your help.
I have an application.
First I display a splash screen, a form, and this splash would call another form.
Problem: When the splash form is displayed, if I then open another application on the top of the splash, and then minimize this newly opened application window, the splash screen becomes white. How do I avoid this? I want my splash to be displayed clearly and not affected by any application.
I'm using a DropDownList but I realized that there is 2 types of it . I found "Dropdown" which makes the text inside the DDL editable, and "DropDownList" which doesn't.
Problem: when I tried to use DropDownList control it doesn't allow me to add a default text while DropDown does so I want a DropDownList control which prevent modifying on the text and allow a default text .. what property should I use?
Can I add "?" which denotes to Help button to the FormBorder (with the minimization, maximization, and close buttons )
Can I change the colour of the Formborder from its default colour (blue) ?
One of my application functionality is to copy files from server to phone into a certain folder in memory card.
Problem : can I determine the free size of the MMC to notify the user if it's full while copying.
3) You have to set the "HelpButton" property of the form to true. However the "?" button is only visible if you deactivate the maximize and minimize buttons by setting "MinimizeBox" and "MaximizeBox" to false.
Here are a few...
1) you need to launch the window in another thread so that your app can do what it needs to do to start. When the startup finishes, signal to the splash screen that it can close itself.
2)
dropDownList.SelectedIndex = 0;
4) I would not recommend doing so. It is based on the system color scheme, which the user sets. I would not like an app to decide for itself which scheme to use.
5) if the MMC shows up as a mapped drive you could use one of these techniques
Once again there is no answer to this guys question.
Yes, do as the other guy said and launch the splash screen in its own thread.
There is only one type of ComboBox in .Net, However there is a property called DropDownStyle which sets its functionality.
Yes, I am clueless on how this one works and never needed it.
Yes you betcha, Its called non-client painting. you can find more info on it here http://www.codeplex.com/CustomerBorderForm/Wiki/View.aspx?title=Painting%20NonClient%20Area&referringTitle=Home
I Need more details on this.