Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calendar popup

Status
Not open for further replies.

njahnavi

Technical User
Dec 29, 2008
136
US
Hi I am using vb.net 2.0

I am using windows forms

I have a form where on click of "add" button my form should show the calendar like a popup and once user select the date in the popup then i have to validate if that is a correct date to add a menu and if it is so then i have to close the popup and show the date in the form...

I am very new to vb.net

Any ideas atleast how to get started will be of great help..

I have searched the net and everyone speak about webform not the windows forms...

Any help is greatly appreciated
 
you should look into the DateTimePicker. It forces the user to pick valid dates, and dtp.Value returns a Date data type. That will assist you in your data validation. Also, it is set as a combo box, that when clicked, shows a calendar to ease of selecting the date.

--------------------------------------------------
Bluto: What? Over? Did you say "over"? Nothing is over until we decide it is! Was it over when the Germans bombed Pearl Harbor? No!
Otter: Germans?
Boon: Forget it, he's rolling.
--------------------------------------------------
 
actually i have used it however my pl wants something which pops up from the from instead of a control sitting in the form..

hope i have given the right explanation...
 
ok... have you looked at the MonthCalendar Control?

--------------------------------------------------
Bluto: What? Over? Did you say "over"? Nothing is over until we decide it is! Was it over when the Germans bombed Pearl Harbor? No!
Otter: Germans?
Boon: Forget it, he's rolling.
--------------------------------------------------
 
Month calendar control is not tehre in my tool box...
I am pretty newbie to vb.net please give more explanation so that i can acheive this task..

thanks for your help...
 
Here is an example to demonstrate some functionality
Code:
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim CalForm As New Form
        Dim Cal As New MonthCalendar
        Cal.MaxSelectionCount = 1
        CalForm.Controls.Add(Cal)
        CalForm.ClientSize = Cal.Size
        CalForm.Height += 24
        CalForm.MinimizeBox = False
        CalForm.MaximizeBox = False
        CalForm.MinimumSize = CalForm.Size
        CalForm.MaximumSize = CalForm.Size
        CalForm.ShowDialog()
        MessageBox.Show(Cal.SelectionStart.ToString)
        CalForm.Close()
        CalForm.Dispose()
        CalForm = Nothing
        Cal.Dispose()
        Cal = Nothing
    End Sub

I'm creating a generic form on the fly, and adding a new MonthCalendar control to it on the fly. Add this code to a Button Click Event, run the program, and click the button. After you close the form, you'll get a message telling you what date the user selected.

For non-demonstration code, you will want to create a small form with a Month Calendar, and probably add an "OK" button to it to close the form. That way, you won't have to create a generic form and it's controls on the fly. But the concept remains -- utilize a small form with a MonthCalendar control and perform a PopUp with ShowDialog.
 
Thanks a lot River Guy this gave me some idea ...

Pelase tell me soemthing..
cant we drag and drop monthcalendar

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top