by Trill on Wed Oct 07, 2009 3:47 pm
Hi you could do some thing like this:
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Counter_left As Integer = 0
Dim Counter_right As Integer = 0
Dim My_positive_number As String
Dim count As String = "left"
My_positive_number = TextBox1.Text 'your positive number with decimal
For x As Integer = 1 To Len(My_positive_number)
If Mid(My_positive_number, x, 1) = "." Then count = "right"
If count = "left" Then Counter_left = Counter_left + 1 Else Counter_right = Counter_right + 1
Next
If count = "left" Then ' Check to see if number had a decimal
MsgBox("please enter a positive number with a decimal")
Else
MsgBox("Left of decimal: " & Counter_left & " Righr of decimal: " & Counter_right - 1)
TextBox2.Text = Counter_left
TextBox3.Text = Counter_right - 1
End If
End Sub
End Class
all you have to do is put 3 text boxes and a button
TextBox1 to input the number
2 & 3 to display the number of digits
Hope this helps
Mr Trill