質問

I got this problem trying to format the values of a specific column but gives me error Object doesn't support this property of method. How can I fix this issue?

Here is my code:

Set dgData.DataSource = rs
dgData.Columns(1).DataFormat = "#,##0.00"
役に立ちましたか?

解決

Try this code

Dim d As Integer
For i as Integer = 0 to dgData.Rows.Count -1
     d = CInt(dgData.Rows(i).Cells(1).ToString
     d.ToString("#,##0.00")
     dgData.Rows(i).Cells(1).Value = d
Next

他のヒント

use NumberFormat instead of DataFormat.

Set dgData.DataSource = rs dgData.Columns(1).NumberFormat = "#,##0.00"

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top