如何在Enter键按下事件时在数据网格视图中生成其关联日期的日期

问题描述:

你好朋友,我想这样显示我的数据网格视图

例如

hello friend i want to show my data grid view like this

e.g.

 Collapse | Copy Code
set NO        date                day
 
1        1/1/2005             Monday
2        7/1/2005             Monday
3        14/1/2005            Monday
4        21/1/2005            Monday
5        28/1/2005            Monday
6        5/2/2005             Monday
7        12/2/2005            Monday
8        19/2/2005            Monday
9        26/2/2005            Monday  


当用户在日期单元格中输入第一个日期时,在按Enter键时,日期列应以日期名称填充,而setNO现在用1填充.光标移至日期列的下一个单元格,以7天将日期设置为dayName以关联日期单元和2代表setNO ...等等...

请朋友帮我..我该怎么办...请拜托.......

谢谢Advanced


as user enter the fist date in date cell , the day column should fill with day name and setNO fill with 1 now as he press enter key the cursor move to the next cell of date column increase date with 7 day set dayName to assosiate day cell and 2 for setNO...an so on...

please friend help me ..what i have to do...please please please.......

thanks in advanced

亲爱的LakhanP

从您的问题中我了解到,当您按Enter键时,焦点应该连续地从一个单元格传递到另一个单元格.
在这里,您必须使用
Dear LakhanP

From your question I understood that when you press enter key the focus should pass from cell to cell in a row.
Here you have to use
_KeyPress

事件.

此链接对您有用


http://*.com/questions/325677/how-to-get-keypressed-keydown-events-from-datagridview-data-cells [

event.

This link useful to you


http://*.com/questions/325677/how-to-get-keypressed-keydown-events-from-datagridview-data-cells[^]

and follow cell_update and dt.DateAdd function as amith said in the above comment

Thanks


k,您可以在数据表的后端生成所需的行,然后将其作为数据源提供给gridview.您也可以稍后在itemtemplate中使用数据表的列名进行绑定来对其进行编辑.
k,you can generate desired rows in backend in a datatable then give it as a datasource to gridview.You can also edit them later as bind in itemtemplate with the columns name of datatable.