I made three projects the first one is a windows form, the second one is a class library and the third one is another class library to be the reference of the second and first projects. Inside my second Project which is a class library there are two files a class file and a windows form. In the windows form I have controls there are textboxes and labels. My problem is the event of the controls does not work. even there is already codes on it. Is there anything I missed or it just the dll doesn't support the events inside and by the way I am using system.reflection because i want this to be a plugin to my main program and also I already made system.windows.forms.form as a reference.

Your knowledge and advise on this matter is highly appreciated. thank you

Recommended Answers

All 3 Replies

Hi,

It'd be easier to figure out if we can see some of your code - where you make the calls etc between the projects.

@G Waddell

this is my interface

Public Interface IGraphicalAddon

    ReadOnly Property Name() As String
    Sub OnClick(ByVal sender As Object, ByVal e As System.EventArgs)

End Interface

this is the code inside my form which resides in a dll

   Private Sub txtbox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtbox1.KeyDown

   if e.keycode = 13 then

           'Do something here
   end if
   end sub

and this is the code that calls the form.

Imports TCPlugs
Public Class OpmTCUpdate
    Implements TCPlugs.Addon

    Public ReadOnly Property Name() As String Implements TCPlugs.Addon.Name
        Get
            Return "Opm TC Update"
        End Get
    End Property

    Public Sub OnClick(ByVal sender As Object, ByVal e As System.EventArgs) Implements TCPlugs.Addon.OnClick
        Dim newuiopmupdate As New OpmTCUpdateForm

        newuiopmupdate.ShowDialog()
    End Sub
End Class

The form will display when the Onclick is being called. My problem is I can't get the events worked inside the dll. but if i pasted the code on the windows form projects it will work normally.

Hi,

Looking at you code, if the form shows as a dialog then your interface and form that calls the code are working... The code inside your form, handles a keypress on txtbox1 inside the form. So when someone enters text into the form does it handle it - what happens? Have you tried putting a msgbox inside the form code to see if it is firing?

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.