Results 1 to 3 of 3

Thread: Invoking a Form inside a Class

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2003
    Posts
    12

    Invoking a Form inside a Class

    Hi,

    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
    ____________________________________________________

    Thanxs in Advance.

  2. #2
    Hyperactive Member CyberHawke's Avatar
    Join Date
    May 2004
    Location
    Washington DC
    Posts
    477
    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.
    Attached Files Attached Files
    Whadayamean it doesn't work....
    It works fine on my machine!

  3. #3

    Thread Starter
    New Member
    Join Date
    Jan 2003
    Posts
    12
    THANKS A LOTTTTT. THAT WAS EXACTLY WHAT I WAS LOOKING FOR >

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width