
Originally Posted by
diazdar
Dim minimumValue As String
if i change it, it renders ' minimumValue = minimumValue.Replace(".", "")'
as useless since that is for a string. How can I use a replace function to change the decimal to nothing,
and if i change it to a double
will that work?
Take a look at this and see if it makes sense
vb.net Code:
Imports System.Text
Public Class Form1
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Dim x As String = GetNumber("9.99")
Dim newbuilder As New StringBuilder
If x.Count < 10 Then
MsgBox(x.Count)
newbuilder.Append("0", 10 - x.Count)
newbuilder.Append(x)
End If
x = newbuilder.ToString
MsgBox(x)
End Sub
Function GetNumber(ByVal theString As String) As String
Dim sa() As Char = theString.ToCharArray
Dim builder As New StringBuilder
For Each n In sa
If IsNumeric(n) Then builder.Append(n)
Next
Return builder.ToString
End Function
End Class

Originally Posted by
diazdar
Code:
Dim newbuilder As New System.Text.StringBuilder
If minimumValue.Count < 10 Then
newbuilder.Append("0", 10 - minimumValue.Count)
newbuilder.Append(minimumValue)
End If
minimum value is the variable. Is that correct? It still doesnt work. I changed line 1 because there was a syntax error. Is that even right?
TRY THIS :
vb.net Code:
Dim newbuilder As New System.Text.StringBuilder
If minimumValue.Count < 10 Then
newbuilder.Append("0", 10 - minimumValue.Count)
newbuilder.Append(minimumValue)
End If
minimumValue = newbuilder.tostring