• Question

  • I writing an API on windows forms that I exposing as a COM interop plugin.  The textbox controls do not behave the same way as the windows executable with the identical code.  My form is a Public class, and when referenced (exe) in my other classes, they are properties.  in the interop code the form can't be referenced unless I create an object of the class, then it is a variable and textbox.text does not show up in the form.  I am dazed and confused  as to why the windows form treats the public class as a property, and the COM class needs to be declared as a Dim of type class.  It is not a pointer so I am assuming that they are 2 distinct "Things".  I have no clue how to make the com class reference and populate controls on the Form.


    Friend Class ApiForm
        Inherits Form
        Dim clsOpenERFileClass As New OpenERFileClass 

    After building a string, I want to set a textbox.text control the the string with this code:

                For i = 0 To currentForm.Controls.Count - 1
                    If currentForm.Controls(i).Name = "txtCodePreview" Then
                        currentForm.Controls(i).Text = tblStr & ";" & vbCrLf & vbCrLf
                    End If

    I have also tried using a local variable of the class for the form and that did not work either.  I am struggling with why the exe with identical code works flawlessly, but when I create the COM interop from the same code, it does not behave the same.

    Friday, March 1, 2019 5:46 PM

All replies

  • Hello,

    You will have much better chances for assistance by showing your code.

    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    profile for Karen Payne on Stack Exchange

    Friday, March 1, 2019 6:42 PM