0

hi,

i am using visual studio 2008 standard edition,
how can i add a calender control to the datagrid view, can someone please help me

thanx
in advance

2
Contributors
10
Replies
14
Views
7 Years
Discussion Span
Last Post by krishnisilva
0

what should i do after adding the class CalendarColumn to the project??
please can u give an answer.

thankxxxxxxxx

0

Use this code in Form_Load after that:

CalendarColumn col = new CalendarColumn();
        this.dataGridView1.Columns.Add(col);
        this.dataGridView1.RowCount = 5;
        foreach (DataGridViewRow row in this.dataGridView1.Rows)
        {
            row.Cells[0].Value = DateTime.Now;
        }

Thanks

0

hey the code u have posted is to display the datatime in the datagrid view, right?
what i want is a calender icon so that the user can select any date.
please can u tell me how to do this.
thnkx in advance...

0

hey thankx farooqaaa,
first i hace to add the Calender column (without the form code)which i in the link u have provided and them add the code u have posted later in the form load event, i am rignt?

and also i have to question can u please help me???

Question 1:

and also when selecting the data from the calender column, the user has to double clil on it to select for a data, how can i make the calender icon open in one click on the cell???

Question 2:
and also how can i get the value of one cell(date time type) to a string varialbe?

appriciate if u could help me with this also ,
thanx

0

Answer 1: Add a CellClick event to the datagridview and use this code:

dataGridView1.BeginEdit(true);

Answer 2: You can use many methods to convert it to string. Use:

cellValue..ToShortDateString();
cellValue..ToShortTimeString();
....and others

Use the one that suits you.

Thanks

0

hey thanx again,
question in answer 2:

is it like this:
String a = dgvDAction[2].ToShortDateString();

please can you specify this clearly, i am not good in C#.

thankxxxxxx

-2

hi,
is there any way i can show the calendder icon close to the datagridview cell when the cursor moves across it???
thanx
please give me an answer someone please.
thanx.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.