I am herewith develop an application but I have created a class which calls button events(i.e. enable or visible).

I am actually created the button events class(classfrmLoad) for the way which buttons should be enabled and visible when each & every form loading.

There are 6 buttons in the forms (frm1, frm2 etc.,) like btnAdd, btnEdit, btnCancel etc., i don't want to display the buttons(visible/enable) while loading the form.

Public Class ClassfrmLoad

Dim btnAdd As New Button
Dim btnEdit As New Button

Private Sub FormLoad()

    Me.btnAdd.Visible = True
    Me.btnAdd.Enabled = True

    Me.btnEdit.Visible = True
    Me.btnEdit.Enabled = False

End Sub

End Class

Here is the question: How can i call this class(classfrmLoad) events to alter (enable/visible) the buttons positioned in the forms(frm1, frm2, etc.,) and how to get the buttons events in those forms?

You can do this by passing object type argument value to the sub procedure. To do this you have to declare object type paprameters in the procedure.
The codes should be

Public Class ClassfrmLoad
    Private Sub FormLoad(btnAdd As Button , btnEdit As Button)
        btnAdd.Visible = True
        btnAdd.Enabled = True
        btnEdit.Visible = True
        btnEdit.Enabled = False
    End Sub
End Class

Now call the pocedure form formloadevent

'Declaring variable of that Class type
Dim x as New ClassFormLoad

'Now call the procedure and pass the Button
'Objects to the procedure
x.FormLoad(Me.Button1, Me.Button2)

Hope it can help you.

Thank you very much for your kind response.
It saved me a lot of time. and Calling proceedure well worked just altering with x.

Dim x As New ClassfrmLoad
        ClassfrmLoad.formLoad(Me.btnAdd, Me.btnEdit, Me.btnSave, Me.btnCancel, Me.btnClose, Me.btnUpdate, Me.btnFind)
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.