VB.Net control that will let you select just a month?

  • Thread starter Thread starter felecha
  • Start date Start date
F

felecha

Is there a control that I can put on a Form that would let a user
select just the month value? I tried to find a way to make the
DateTimePicker or the Month Calendar do what I want but I can't. I
want a way for the user to say "Let me see what is in the database
for the month of January 2004." I don't want to have it specified as
January 1 through January 31. I can do that in code behind it. I
could use a combo, and just enter

January 2004
February 2004
March 2004
etc.

That would be perfectly satisfactory. For this customer, there is no
need to go back to the past. But unless I put 10 years worth of
months in the combo, there's a problem, as you can see.

Are there custom controls out there for sale? There must be
something, but this is new to me and I don't know where to look.

Thanks
 
Why don't you make a control that has both the month and the year as
dropdowns or spinners. Then, you could use it to select a month and then a
year. Then, you just need to add the months to the first dropdown or
spinner, and dynamically build the list of years into the second dropdown or
spinner.

Just an idea.

felecha said:
Is there a control that I can put on a Form that would let a user
select just the month value? I tried to find a way to make the
DateTimePicker or the Month Calendar do what I want but I can't. I
want a way for the user to say "Let me see what is in the database
for the month of January 2004." I don't want to have it specified as
January 1 through January 31. I can do that in code behind it. I
could use a combo, and just enter

January 2004
February 2004
March 2004
etc.

That would be perfectly satisfactory. For this customer, there is no
need to go back to the past. But unless I put 10 years worth of
months in the combo, there's a problem, as you can see.

Are there custom controls out there for sale? There must be
something, but this is new to me and I don't know where to look.

Thanks



----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption
=---
 
You can do this with the DateTimePicker by Setting the CustomFormat to "MMMM
yyyy" and setting the Format to "Custom".

When you retrieve the value from the DTP by using its "Value" property, make
sure you parse the value so you only use the month and year as the DTP has a
habit of keeping the full precision date behind the scenes.

HTH,

Trev.

felecha said:
Is there a control that I can put on a Form that would let a user
select just the month value? I tried to find a way to make the
DateTimePicker or the Month Calendar do what I want but I can't. I
want a way for the user to say "Let me see what is in the database
for the month of January 2004." I don't want to have it specified as
January 1 through January 31. I can do that in code behind it. I
could use a combo, and just enter

January 2004
February 2004
March 2004
etc.

That would be perfectly satisfactory. For this customer, there is no
need to go back to the past. But unless I put 10 years worth of
months in the combo, there's a problem, as you can see.

Are there custom controls out there for sale? There must be
something, but this is new to me and I don't know where to look.

Thanks



----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption
=---
 
In addition, set the "ShowUpDown" property to true to disble the drop down
calendar.

HTH,

Trev.
 
* (e-mail address removed)-spam.invalid (felecha) scripsit:
Is there a control that I can put on a Form that would let a user
select just the month value? I tried to find a way to make the
DateTimePicker or the Month Calendar do what I want but I can't. I
want a way for the user to say "Let me see what is in the database
for the month of January 2004." I don't want to have it specified as
January 1 through January 31. I can do that in code behind it. I
could use a combo, and just enter

Why not use DateTimePicker + a custom date format ('CustomFormat' and
'Format' property)?
 
I had to have a date control that allowed blank dates. So far, I haven't
come across a way to blank out the DateTimePicker. So, I've written my own
set of blank date controls.

If there is a good way to blank out the DTP though, I'd love to know it. :)
And using that checkbox isn't a good way to handle this.
 
* "Scott Kilbourn said:
I had to have a date control that allowed blank dates. So far, I haven't
come across a way to blank out the DateTimePicker. So, I've written my own
set of blank date controls.

If there is a good way to blank out the DTP though, I'd love to know it. :)
And using that checkbox isn't a good way to handle this.

Why not? It's the preferred way, even Outlook Express handles it that way.
 
Woo - some good ideas. Thanks. I'm new to a lot of stuff, didn't
know you could build your own control. never tried a spinner
before.

Can't wait to get to work
 
-----Original Message-----
Is there a control that I can put on a Form that would let a user
select just the month value? I tried to find a way to make the
DateTimePicker or the Month Calendar do what I want but I can't. I
want a way for the user to say "Let me see what is in the database
for the month of January 2004." I don't want to have it specified as
January 1 through January 31. I can do that in code behind it. I
could use a combo, and just enter

January 2004
February 2004
March 2004
etc.

That would be perfectly satisfactory. For this customer, there is no
need to go back to the past. But unless I put 10 years worth of
months in the combo, there's a problem, as you can see.

Are there custom controls out there for sale? There must be
something, but this is new to me and I don't know where to look.

Thanks



----== Posted via Newsfeed.Com - Unlimited-Uncensored- Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
.
hello there
what you need to do is first in the database : if you are
using a view then add a column to this view : if the date
field is for example xx_date then define the new column
in the view as DATENAME(month,date) which returns the
month name (january, february, etc); it is a function in
sqlserver (Transact_sql).
on your form creat a text box for the year to be entered
and a combo box containing the names of the 12 months
namely january, february, march, ...december).
adjust the select statement in your oleadapter to have ?
for the column created above. then upon entry of the year
and month you can use the year entered as the first
parameter and the month name as the second parameter !!
as follows:

myadapter.SelectCommand.Parameters(0).Value = year
(entered)
myadapter.SelectCommand.Parameters(1).Value = month *from
combo box)

you can do the same by using the month no. instead of
name if you want to but in this case the function
returning the month no. from the date will be MONTH
(xx_date) which returns 1 for jan, 2 for feb ..etc. and
you can have both values selected by entering in regular
text boxes.
if you need more help contact me be e-mail
 
Back
Top