Modifying VB.NET NumericKeyPress event code to C++

I asked this stackowerflow before but there were no reply. http://stackoverflow.com/questions/15159576/modifying-vb-net-numerickeypress-event-code-to-c

Can someone modify this for me?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Private Sub NumericKeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
        If e.KeyChar = Chr(Keys.Back) Then
        Else
            If Not Char.IsDigit(e.KeyChar) Then
                e.Handled = True
                Beep()
            Else
                If Len(TextBox1.Text) > 0 Then
                    If Val(TextBox1.Text) > 105097565 Then
                        e.Handled = True
                        Beep()
                    End If
              End If
                    End If
         End If
    End Sub


Or tell me how is: 1.NumericKeyPress event? 2.How to say e.KeyChar? 3.How to say IsDigit? 4.How to say Chr(ASCII number)? 5.How to handle e.Key? 6.How to system beep?

I tried:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
private: System::Void textBox1_KeyPress( Object^ sender, System::Windows::Forms::KeyPressEventArgs^ e )
                {
                    if(e->KeyChar == (Char)8)
                    {}
                    else 
                    {
                    if (!Char::IsDigit(e->KeyChar))
                    {
                    e->Handled = true;
                    }
                    else
                    {
                    if (textBox1->Text->Length > 0)
                    {
                    if (int::Parse(textBox1->Text) > 105097565)
                    {
                    e->Handled = true;
                    }
                    }
                    }
                    }
                 } 



but it didn't work.
I added

this->textBox1->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &MyForm::textBox_KeyPress);
to
1
2
#pragma region Windows Form Designer generated code
		void InitializeComponent(void)
Topic archived. No new replies allowed.