0

I am trying to design a calculator. I want to use the Kryptonbutton from the Krypton Component Suite. This is the code I have so far to display 0-9 in the calculator display.

Private Sub KryptonButton_Click(sender As Object, e As EventArgs) Handles KryptonButton1.Click, KryptonButton2.Click
        Dim b As Button = sender
        If TextBox1.Text = "0" Then
            TextBox1.Text = b.Text
        Else
            TextBox1.Text = TextBox1.Text + b.Text
        End If
 End Sub

when I run the program and click the button I get the error msg : InvalidCastExecption was unhandled.
Additional Information: "Unable to cast object of type 'ComponentFactory.Krypton.Toolkit.KryptonButton' to type 'System.Windows.Forms.Button'."

the code only has the 1st two buttons right now KryptonButton1.Click, KryptonButton2.Click. The final code will have button0 thru button9

Any help or suggestion would be helpful. Thanks.

2
Contributors
1
Reply
4
Views
1 Year
Discussion Span
Last Post by Reverend Jim
0

Read the error message. It tells you exactly what you are doing wrong.

That's the problem with 3rd party controls. In order to get help you have to attract the attention of someone else who also uses those controls. What special functionality do you get that you don't have with standard vb (and you really should be using vb.net, not an ancient dialect like vb6)?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.