
The chael
Newbie
Apr 5, 2006, 9:08 PM
Post #5 of 6
(426 views)
Shortcut
|
|
Re: [Jaymzanator] My first "client"
[In reply to]
|
Can't Post
|
|
yes, that works, thanks. I would use that on an ordinary calculator.However I figured out a useful way to do they same thing your error handler is doing, blocking strings from a textbox: Private Sub TextBox5_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox5.KeyPress If Not Char.IsDigit(e.KeyChar) AndAlso Not Char.IsControl(e.KeyChar) Then e.Handled = True End If End Sub
This doesn't let you enter letters at all which is good. Problem is it doesn't allow decimal places, but then, my calculator is in a RS2 client and you do not get 4.5gp or anything like that in RS. There is something you could help me with though, and it just means 'tweaking' your error handler a bit. At the minute it displays an error message when you click calculate (or similar) and you had a string in either box. How could the code be changed so that it brought up the message when a user entered a letter in one specified textbox? (this would before the time delay box in the auto typer). I am asumming it would be a KeyDown / KeyPress event. I would need to be able to enter decimal places in this btw.
|