Windows Develop Bookmark and Share   
 index > ClickOnce and Setup & Deployment Projects > Month Calendar Value
 

Month Calendar Value

Hi All -

i have been using a datepicker in my programs (below code) and not i want to startup a monthCalendar.

the code i used to get a value from the datepicker in my sql is:

-----------------------------------------------------------

Dim instanceFrom As DateTimePicker = DatePickFrom1
Dim instanceTo As DateTimePicker = DatePickTo1
Dim dte, dte2 As DateTime
Dim dteFrom, dteTo As String

dte = instanceFrom.Value
dte2 = instanceTo.Value

dteFrom = dte.ToString("dd/MMM/yyyy")
dteTo = dte2.ToString("dd/MMM/yyyy")

-----------------------------------------------------------

i have tried to replicate this for a monthcalendar, but no luck...

-----------------------------------------------------------

Dim instanceFrom As Monthcalendar = monthcalendar1
Dim Caldate As DateTime
Dim CaldateValue To As String

Caldate = instanceFrom.Value

CaldateValue = Caldate .ToString("dd/MMM/yyyy")

-----------------------------------------------------------

So essentially i want the user to select a date from the MonthCalendar (but just clicking/highlighting it)

and then i can use that date in my sql..

any ideas would be appreciated!!!

Poy  Tuesday, November 20, 2007 11:46 AM

Hi, Poy,

Based on my understanding, you want to know how to get the selected Date from your MonthCalendar, don't you?

In fact, the MonthCalendar does not have a property of Value, you should use selection instead.

For example,

Code Block

Dim instanceFrom As MonthCalendar = MonthCalendar1

instanceFrom.MaxSelectionCount = 1 'Only select one date

Dim Caldate As DateTime

Dim CaldateValue As String

Caldate = instanceFrom.SelectionRange.Start

CaldateValue = Caldate.ToString("dd/MMM/yyyy")

MessageBox.Show(CaldateValue)

More info

http://msdn2.microsoft.com/en-us/library/system.windows.forms.selectionrange(VS.80).aspx

Hope this helps,

Regards

Hi, Poy,

Based on my understanding, you want to know how to get the selected Date from your MonthCalendar, don't you?

In fact, the MonthCalendar does not have a property of Value, you should use selection instead.

For example,

Code Block

Dim instanceFrom As MonthCalendar = MonthCalendar1

instanceFrom.MaxSelectionCount = 1 'Only select one date

Dim Caldate As DateTime

Dim CaldateValue As String

Caldate = instanceFrom.SelectionRange.Start

CaldateValue = Caldate.ToString("dd/MMM/yyyy")

MessageBox.Show(CaldateValue)

More info

http://msdn2.microsoft.com/en-us/library/system.windows.forms.selectionrange(VS.80).aspx

Hope this helps,

Regards

Well done again...

worked a treat!

appreciate your help...

Regards;

Poy.

Poy  Monday, November 26, 2007 10:07 AM

You can use google to search for other answers

Custom Search

More Threads

• how to uninstall a deployed web site completely?
• How to register with window to view specific file format?
• Running applications on login
• How can I do Unattended install.........
• ClickOnce Specific path for intallation in target machine
• ClickOnce Setup error: Bad logon or password
• I am having trouble running a VB.Net application on a client computer which is the only one that has Winnt as system root...
• saving seperate application data for every user
• Microsoft solution- -RenewCert doesnot work for the Click once deployment
• Change folder permissions