Hi all,
Scenario:
I have a MonthCalendar control, and DataGridView. Depending on dates
displayed in MonthCalendar I want to update information from database.
The Possible Solution:
So I must use DateChanged and/or DateSelected events to get the new dates
and update info from the database. Let’s say the implementation is simple:
in these events I call a function passing the SelectionStart and
SelectionEnd which updates the database.
The problem:
Let's say I use DateChanged event. If user uses the navigation buttons and
navigates from one month to other, the DateChanged event is fired two times
(in our scenario - two calls to the database)
If the user decides to select dates with the mouse by simply dragging
through them. Let's say he starts at 05.15 and ends at 05.19 day. DataChange
event is fired 5 times (in our scenario - five calls to the database)
So we are wasting database resources.
If I try to use the DateSelected event, things are better, the event is
fired one time if the date is selected, but event isn't fired at all if user
uses buttons for navigation
Any ideas? 2 5518
"meska" <me***********@ fmu1.net> wrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. .. Hi all,
Scenario:
I have a MonthCalendar control, and DataGridView. Depending on dates displayed in MonthCalendar I want to update information from database.
The Possible Solution:
So I must use DateChanged and/or DateSelected events to get the new dates and update info from the database. Let's say the implementation is simple: in these events I call a function passing the SelectionStart and SelectionEnd which updates the database.
The problem:
Let's say I use DateChanged event. If user uses the navigation buttons and navigates from one month to other, the DateChanged event is fired two times (in our scenario - two calls to the database)
If the user decides to select dates with the mouse by simply dragging through them. Let's say he starts at 05.15 and ends at 05.19 day. DataChange event is fired 5 times (in our scenario - five calls to the database)
So we are wasting database resources.
If I try to use the DateSelected event, things are better, the event is fired one time if the date is selected, but event isn't fired at all if user uses buttons for navigation
Any ideas?
It seems to me that what you want is to update the database when the user
FINISHES doing things on the MonthCalendar. Some ideas for this are:
- provide an explicit way for the user to indicate this, e.g. an "Update
Now" button;
- update the databse when the user moves away from the Monthcalendar,
perhaps by handling the Validating event;
- update the database when no changes happen on the MonthCalendar for a few
seconds (start a timer whenever the DateChanged event is fired (first
cancelling the timer if it's already going), then update the database when
the timer expires).
Hope this helps.
Chris Jobson
"meska" <me***********@ fmu1.net> wrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. .. Hi all,
Scenario:
I have a MonthCalendar control, and DataGridView. Depending on dates displayed in MonthCalendar I want to update information from database.
The Possible Solution:
So I must use DateChanged and/or DateSelected events to get the new dates and update info from the database. Let's say the implementation is simple: in these events I call a function passing the SelectionStart and SelectionEnd which updates the database.
The problem:
Let's say I use DateChanged event. If user uses the navigation buttons and navigates from one month to other, the DateChanged event is fired two times (in our scenario - two calls to the database)
If the user decides to select dates with the mouse by simply dragging through them. Let's say he starts at 05.15 and ends at 05.19 day. DataChange event is fired 5 times (in our scenario - five calls to the database)
So we are wasting database resources.
If I try to use the DateSelected event, things are better, the event is fired one time if the date is selected, but event isn't fired at all if user uses buttons for navigation
Any ideas?
It seems to me that what you want is to update the database when the user
FINISHES doing things on the MonthCalendar. Some ideas for this are:
- provide an explicit way for the user to indicate this, e.g. an "Update
Now" button;
- update the databse when the user moves away from the Monthcalendar,
perhaps by handling the Validating event;
- update the database when no changes happen on the MonthCalendar for a few
seconds (start a timer whenever the DateChanged event is fired (first
cancelling the timer if it's already going), then update the database when
the timer expires).
Hope this helps.
Chris Jobson This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: yener |
last post by:
i noticed that dateChanged method of monthCalendar is automatically fired
every two minutes. when i searched the groups , i see someone asked this
before, there was one short answer and it was -i guess- in spanish.
does someone has an answer or know spanish?
yener
link to thread:
http://groups.google.com/groups?hl=tr&lr=&ie=UTF-8&oe=UTF-8&c2coff=1&threadm=5bd701c3e602%24836037f0%24a301280a%40phx.gbl&rnum=1&prev=/groups%3Fhl%3Dtr%
|
by: steven |
last post by:
A monthcalendar checks every 2 minutes if theres a new day. Does anyone
knows how to disable this ?
The problem is that, everytime a monthcalendar checks this, the form
where the monhcalendar is on, gets the focus, which is VERY annoying.
Thanks,
Steven
|
by: steven |
last post by:
Start a new project with 2 forms: one with a datagrid, a button and a
monthcalendar, and another form without controls.
Try this code in your form with the monthcalendar:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim frm As Form
frm = New Form2
frm.Show()
|
by: vbmark |
last post by:
I want the MonthCalendar control to return the single day selected.
I have MaxSelectionCount = 1.
What I get back though is this:
"SelectionRange: Start: 5/5/2005 12:00:00 AM, End: 5/5/2005 12:00:00 AM"
How do I get the single day date?
|
by: DS |
last post by:
I seem to have stumbled upon something that I can't explain and was
wondering if someone else could maybe help me figure out why this
happens. I've tried it in both VS2003 and with VS2005b2 and in both
cases the result is the same: an ArgumentOutOfRangeException.
Add the following to a blank WindowsForm in C# then call doStuff() from
the constructor or a buttonClick event. If you click on any date, it
pops up a messageBox (as it should)...
| |
by: meska |
last post by:
Hi all,
Scenario:
I have a MonthCalendar control, and DataGridView. Depending on dates
displayed in MonthCalendar I want to update information from database.
|
by: mtczx232 |
last post by:
before we discuss about the problem:
1.it's pity that microsoft not supply event that occur only when Today
is change.
2. it's not clear for what have DateSelected event. why I need to deal
with only select with Mouse?
3. I try to change the selection (on mode of max 1 for selection) by
mouse, and DateSelected not fire
Now we will start the story
When the user browse month with button top of control, the DateChanged
|
by: Randy |
last post by:
Based on the date that the user selects, I'm trying to make the
MonthCalendar control highlight the entire week. In my case, the week
is from Monday - Sunday. I thought that using AddBoldedDate along
with selectionrange.start and .end would accomplish this, but it
doesn't.
Here is my code:
Private Sub MonthCalendar1_DateChanged(ByVal sender As System.Object,
ByVal e As System.Windows.Forms.DateRangeEventArgs) Handles
|
by: Randy |
last post by:
I have a MonthCalendar on one of my forms. I have disovered that the
DateChanged event is triggered not only when the user clicks on a new
date, but also if they click on the Previous or Next Month arrows
(meaning they click on either of the left or right pointing arrows in
the top corner). If the user changes the month, it messes up some of
the date logic that I have in the DateChanged event. Does anybody
know how I can capture this...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |