I’ve been at this for an hour, but I can’t seem to format a string as a percent while I am looping through a datatable. Any ideas? The string value that is being passed in is “3.22”
Public Function securityDt() As DataTable
Dim secMasterDt As New clsDataSecurity
Dim dt As New DataTable
dt = secMasterDt.getSecurityMasters()
For Each row As DataRow In dt.Rows
Dim divYieldColumn As String
divYieldColumn = String.Format("{0:p}", row("dividend_yield"))
row("dividend_yield") = divYieldColumn
Next
Return dt
End Function
Thanks!
Try something like this.
“P” = default 2 decimal places
“P1” = 1 decimal place.
hopefully this helps.