Jacob Du
Jacob Du

Reputation: 1

Tax Calculator Code Help Visual Basics

So I am working on a tax calculator as an assignment on my visual basics class, I have had 2 ideas for this to work and i cant figure either of them out.

A. I declared TaxRate as a double and the user would open form2 to set the rate, but how can I use a double from FORM1 on FORM2 and save it?

B. I could have the double equal to form2.textbox1.text but then I how I limit the textbox to 1 Dot and Numbers, DOts, and Backspace only?

My current code is:

Dim allowedChars As String = "0123456789"
    If allowedChars.IndexOf(e.KeyChar) = -1 Then
        e.Handled = True
    End If

and I cant use backspace or dots (I found this sample online.)

Upvotes: 0

Views: 640

Answers (1)

Eric Cheng
Eric Cheng

Reputation: 1

A, you need to use a global variable e.g Public Shared Variable name as string... B, Create a new event handler for key-press event of the textbox, and u would need to use e.handled.

Upvotes: 0

Related Questions