Try
TextBox3.Text = TextBox3.Text.Replace(",000", "K")
Catch ex As Exception
End Try
number1 = 25000
Try
Dim string1 As String = number1.ToString
TextBox3.Text = string1.Replace("000", "K")
Catch ex As Exception
End Try
Public Function ConvertToFromK(ByVal Value as Integer) as String
If Value < 1000 then Return Value.ToString
Return Value/1000 & "k"
End Function
Public Function ConvertToFromK(ByVal Value as String) as Integer
If Not Value.toLower.EndsWith(k) then Return Cint(Value)
Return Value*1000
End Function
Really, why would there be? Using "K" for thousand in that way is slang, not anything official.
Public Function DataLength(ByVal Length As Integer, Optional ByVal Precision As Integer = 3) As String
Dim tmp As Double = Length
Dim ex As String = "B"
If tmp > 1024 Then
tmp = tmp / 1024
ex = "KB"
If tmp > 1024 Then
tmp = tmp / 1024
ex = "MB"
If tmp > 1024 Then
tmp = tmp / 1024
ex = "GB"
If tmp > 1024 Then
tmp = tmp / 1024
ex = "TB"
End If
End If
End If
End If
Return Math.Round(tmp, Precision) & " " & ex
End Function
dim ReturnAns As string = DataLength(Val(MyText.Remove(",")),2)