i have a datagridview the contents are as follows when i load the datagridview

enter image description here

for the column Payment ID i want the IDs to be like P00001 i know i have to use the mask \P99999 but the question is how? any help would be appreciated thanks in advance.. and the input mask in the access database from where i'm importing the data is \P99999;;#

有帮助吗?

解决方案

E.g.

Dim table As New DataTable

With table.Columns
    .Add("Formatted", GetType(Integer))
    .Add("Unformatted", GetType(Integer))
End With

With table.Rows
    .Add(1, 1)
    .Add(2, 2)
    .Add(3, 3)
End With

Me.DataGridView1.DataSource = table
Me.DataGridView1.Columns(0).DefaultCellStyle.Format = "\P00000"
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top