Hai,
My windows application in C#.net should display time which
is also running like System time. And i hv to check time as morning 10.00AM to next day morning 10.00AM. if this happen it should clear the grid data and display new grid without value. How can i Do this?
Thanks in advance
9 3463
Read up on DateTime object.
DateTime.Now
DateTime.Now.ToString("hh:mm tt");
Play a bit with that and come back with the code you create if you are still having issues.
@tlhintoq
Thanks for Replying me,
I hv display system time in textbox with the code - private void timer1_Tick(object sender, EventArgs e)
-
{
-
textBox1.Text = DateTime.Now.ToString("h:mm:ss tt");
-
}
-
but i dont knw how to trigger event on specific time in c#.net
let say if time reaches 10.00AM it trigger tht event as refresh tht grid
reply me
but i dont knw how to trigger event on specific time in c#.net
There isn't a pre-built event for that.
You will have to write your own.
Basically a set of 'if' conditions that you can put inside the Tick event is a good basic start. This will get you started for concept, but you'll need to beef it up. - If (DateTime.Now.Hours == AlarmTime.Hours)
-
{
-
if (DateTime.Now.Minutes == AlarmTime.Minutes)
-
{
-
if (!RanToday) RaiseTodaysAlarmEvent();
-
}
-
}
@tlhintoq
Can u explain me more. What's this code mean? i need to display data in datagridview with the sql query, it should check morning 10AM to next day 10AM. it displays the data in datagridview with this query and next day it should display new page. need to check with time and date.
Thanks in Advance
So you're saying that you have a program that will be constantly running, and needs to have something happen every 24 hours?
You could use a timer and set the interval to 24 hours (86,400,000 ms). Subscribe to the timer's tick event and do your update there.
@insertAlias
The problem with that is that if the something is supposed to happen every day at 10am, but the program is started at 1pm then repeats every 24hours....
Better to have a settable field for the time, then check to see if now is approximately equal to that time
Yeah I forgot about the whole start time thing. There is probably an even better solution, like a refresh button, or closing the app when you are done, and opening it when it's time to use it.
@insertAlias
User interaction seems to be contrary to the idea of automated server functions.
In my own apps I found it easiest to write a little component that is given a time like an alarm clock. At the appointed time it raises an 'AlarmEvent'. Whichever parts of the main application that are subscribed are welcome to do their thing when the alarm rings. Doesn't mater if its 1 piece, 100 pieces or no pieces, the alarm rings whether someone is listening or not. Much like my beside clock.
The alarm clock sits in my toolbar and is available to any program I need it in, just like a TextBox or any other control.
@tlhintoq
I agree fully, however, the OP mentioned that it would be displaying data in a datagridview, which suggests to me that this isn't really a server app.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: anaxamandr |
last post by:
Hi.
I have a long loop in ASP that performs a rather lengthy calculation. I would love for my users to be able to stop that calculation, if they so choose, mid way through the process.
I attempted...
|
by: Terry |
last post by:
I have used the code provided in the PreciseDateDiff function at the
following Access Web link to calculate the time change date (from
Daylight to Standard time and vice versa):
...
|
by: Tom |
last post by:
A field in a data set I want to import into Access is in Unix time (seconds from
a certain time on a certain date). Does anyone know the precise date and the
precise time on that date that Unix is...
|
by: Quina |
last post by:
Hi there, i'm building an windows application to manage my disc
collection. I also want to enable it with cd recognition features on
audio CDs. In order to do this I must submit the CD info...
|
by: ram.ragu |
last post by:
hi
i have problem to calculate idle time of cpu and if idle time is
more then i have to shut down the system. can anyone tell me the idea
to so that please
|
by: andreas |
last post by:
Hi,
I have a calculation program in vb.net who is running for let us say for
more than a hour.
When I will do meanwhile something els in a office program I see that my
calculation program takes a...
|
by: Satish Itty |
last post by:
Hi all,
I have a big problem in my hands and not sure how I can fix this. Any
suggestions would be greatly appreciated.
I have a .NET 3 tier app developed in VS2003 and .NET 1.1. the client is a...
|
by: Lara1 |
last post by:
I'm trying to get certain cells to show a hovering alert message when I click on them. (I don't want an error-message style box to pop up, because I'll eventually want it to show for lots of cells...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |