Hi All
I have this code:
which counts the words in the text box tbUpperBody. It then divides the number of words by 3. I need the value of ToolStripLabel1 to be a time. So, this means that if the value of the word count after it's divided by 3 is greater than 60, it needs to display it as 01:23 (for one minute, 23 seconds)Code:Private Sub tbUpperBody_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tbUpperBody.TextChanged Dim c As String() = tbUpperBody.Text.Split(" ") Dim wc As Integer = 0 For i As Integer = 0 To c.Count - 1 If Trim(c(i)) <> "" Then wc += 1 'ignore items in array that have only spaces Next ToolStripLabel1.Text = "[TL: " & Math.Round(wc / 3, 0) & "]" 'total word count If (wc / 3) >= 60 Then ToolStripLabel1.Text = "[TL: " & Math.Round((wc / 3) / 60, 2) & "]" End If End Sub
I cannot get the label to format the number correctly. It gives me values in decimals at the moment, for example "1.78" which makes no sense int he context of a time value.
I really appreciate any help on this one!
Thanks




Reply With Quote
