Solved

restrict DTPicker in vb6

Posted on 2014-01-22
3
341 Views
Last Modified: 2014-01-22
I have the following code below to find if the day of the month is before the 9th.

If Day(currentServerTime) >= 9 Then
                    SelectMonth = Format(DateAdd("m", -1, currentServerTime), "yyyy-mmmm")
                    'DTPicker1 = ?
                End If
            End If

Open in new window


If it is before the 9th, I would like to limit the calendar in DTPicker to only the current month.  Is it possible to do this so that a user can only choose the current month?
0
Comment
Question by:al4629740
  • 2
3 Comments
 
LVL 4

Accepted Solution

by:
ravikantninave earned 500 total points
Comment Utility
Surely, you can do this.  If you have to restrict date after certain date then use

dateTimePicker.MaxDate= yourdate
0
 

Author Comment

by:al4629740
Comment Utility
can DTPicker also default to the current date?

or does that have to happen programmatically?
0
 
LVL 4

Expert Comment

by:ravikantninave
Comment Utility
I Generally use this to show current date when my form loads from my vb6 app

DTPicker1.MaxDate = Format(Date, "dd/mmm/yyyy")
DTPicker1.Value = Format(Date, "dd/mmm/yyyy")
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now