iam reading scale values from a scale in vb.net. now iam getting values like 33333kg and 55555kg and I want to format it such that I get values like 33.333kg and 55.555kg

Are you receiving that back as a formatted string?

If so, can you do something like this?:

Imports System.Text.RegularExpressions
Module Module1
   Function ConvertValueString(ByVal strValueString As String) As String
      Dim dbl As Double = 0
      Double.TryParse(Regex.Replace(strValueString, "[^0-9]", ""), dbl) ' digits only
      Return (dbl / 1000).ToString() & "kg"
   End Function

   Sub Main()
      Console.WriteLine(ConvertValueString("33333kg"))
   End Sub
End Module

this does the trick

Dim str As String = "33333kg"
Dim newstr As String
newstr = Microsoft.VisualBasic.Left(str, 2) + "." + Microsoft.VisualBasic.Right(str, 5)
Label1.Text = newstr

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.