Is there something like the javascript val() function in Visual Basic I want to take a text area and display the value in a dollars using formatCurrency( ) function. But of course that requires that the field is always numeric. I'd probably like to do this in a quick and dirty way and just convert anything that's not an actual number to zero. I am just looking for the quickest way to do that.

VB Equiv. of val( ) function
GEO_Barrett
hi,
i'm not sure if there are something preprepared for that like javascript or not but you can do that by code its not hard
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'call the function and display it in messagebox MessageBox.Show(val(TextBox1.Text))
End Sub 'you can write this function Private Function val(ByVal value As String)
Dim result As Double Dim success As Boolean = Double.TryParse(value, result)
If success = True Then Return String.Format("{0:C2}", result)
Else Return String.Format("{0:C2}", 0.0)
End If End Function
End Class
hope this helps
marouane
FireSon
Or you can just use Val() in the Microsoft.VisualVasic namespace.