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.

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)?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.