Inside a class i want to make user interface such that the user can input values. I want a form to be invoked which will have lets say 2 text boxes and one button. Then the user will input the integers in the text box and click Button. And then the operation Add(num1,num2) will be performed.
Can anyone Please guide me on this.
I am pasting the code below.
___________________________________________________
Option Strict On
Option Explicit On
Public Class Class1
Friend Function Calculate() as integer
Dim num1 As Integer
Dim num2 As Integer
' I want to Invoke a Form here with two text Boxes and a Button to input the values for num1 and num2
Add(num1,num2)
End Function
Friend Function Add(ByVal x As Integer, ByVal y As Integer) As Integer
Return x + y
End Function
End Class
____________________________________________________
You can't quite do it the way you are trying, but this example will show you how it can be done. When opening your form, you need to pass a reference of your class to the form that it is instantiating and have a couple of public members that the form can populate.
But enough of trying to describe it, this example project does what you are asking.
Whadayamean it doesn't work....
It works fine on my machine!