我正在从 json 源中获取我的数据。然后我将它转换为一个类类型,然后我将它设置为 datagridview 的数据源。
此列的值类似于:
12A12345
我希望能够像这样格式化它:
12-A-123-45WR
private void dgvListDrivers_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
if (e.ColumnIndex == 3)
{
int value;
if (e.Value != null)
{
e.CellStyle.Format = "##-#-###-##WR";
e.FormattingApplied = true;
}
}
}
但是这段代码不起作用......