整列的DataGridView单元格格式 [英] DataGridView cell formatting for a whole column

查看:78
本文介绍了整列的DataGridView单元格格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好编码员,



我在表单上有一个DataGridView,它从数据库加载数据。



此DataGridView中的两个列(TimeStart,TimeEnd)是特定于时间的,即:13:30或09:55



我需要某种格式这意味着用户只能键入4个数字字符,然后在输入四个字符后,在前两个字符后面放置一个冒号。



例如:



1.用户输入一个单元格,单元格中的值突出显示。

2.用户输入:1250

3.输入最后一个字符后,在第二个字符后放置冒号。

4.用户离开单元格,值为:12:50



非常感谢任何评论和回答,谢谢。

Hello coders,

I have a DataGridView on a form, that loads data from a database.

Two of the columns (TimeStart, TimeEnd) in this DataGridView are time specific, ie: 13:30 or 09:55

I need some sort of formatting that means the user can only type in 4 numeric characters, then a colon is placed after the first two once the four characters have been typed.

For example:

1. User enters a cell, the value in the cell is highlighted.
2. User types in: 1250
3. Once the last character has been typed, a colon is placed after the second character.
4. User leaves cell, and value stands at: 12:50

Any comments and answers are greatly appreciated, thanks.

推荐答案

试着看看:Nulla ble Masked Edit,以及更好的蒙面编辑! [ ^ ]


这篇关于整列的DataGridView单元格格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆