Displaying a form from a dll that resides in the dll

pts.
Tags:
Visual Basic
I have an application that has an API which I am attempting to use. The API allows me to modify (add) to the applications menus. I have added a new menu item and by modifying the appications registry settings I am able to assign a DLL to the new menu item. I have done a basic test and the menu works and I have been able to display a messagebox when I choose the menu item. I have a form in the project that I would like to disply instead of the message box. I have modified the code to display the form but nothing happens. I do not get an error message and the main application hangs. I have to close the application from within task manager. The code below works up to the msgbox "Got Here!" but does not display the form with the next line. The form in the code is called frmDisplay and the form contains an MSFlexGrid Control. code: Private Function CompareProfiles(ByVal pProfiles As DOCSObjects.IDocProfiles) ' THIS FUNCTION DISPLAYS A MSFLEXGRID CONTROL DISPLAYING THE PROFILE FORM VALUES ' FOR ALL THE PROFILES PASSED IN THE ARGUMENT. Dim ColumnName As String Dim ColumnValue As String Dim Column As DOCSObjects.Column Dim Profile As DOCSObjects.Profile Dim GridRowIndex As Integer Dim GridColumnIndex As Integer GridRowIndex = 0 GridColumnIndex = 0 frmDisplay.grid.Rows = 1 ' FIRST COLUMN OF GRID CONTAINS PROFILE COLUMN NAMES. ' THERE IS A SUBSEQUENT COLUMN FOR EACH PROFILE IN THE COLLECTION. frmDisplay.grid.Cols = pProfiles.Count + 1 For Each Column In pProfiles(1).Columns frmDisplay.grid.Rows = frmDisplay.grid.Rows + 1 ColumnName = Column.Name frmDisplay.grid.TextMatrix(GridRowIndex, GridColumnIndex) = ColumnName frmDisplay.grid.ColWidth(GridColumnIndex) = 2500 frmDisplay.grid.ColAlignment(GridColumnIndex) = flexAlignLeftTop For Each Profile In pProfiles GridColumnIndex = GridColumnIndex + 1 frmDisplay.grid.ColAlignment(GridColumnIndex) = flexAlignLeftTop frmDisplay.grid.ColWidth(GridColumnIndex) = 2500 ' PROFILES WILL NOT NECESSARILY ALL CONTAIN THE SAME COLUMNS. ColumnValue = "COLUMN NOT FOUND ON PROFILE" On Error Resume Next ColumnValue = Profile.Columns(ColumnName).Value If Err.Number <> 0 Then Err.Clear On Error GoTo 0 frmDisplay.grid.TextMatrix(GridRowIndex, GridColumnIndex) = ColumnValue Next GridRowIndex = GridRowIndex + 1 GridColumnIndex = 0 Next frmDisplay.grid.Rows = GridRowIndex - 1 ' ANY FORMS DISPLAYED BY THIS DLL MUST BE SHOWN MODALLY. MsgBox "Got Here!" frmDisplay.Show vbModal End Function Hope that this is enough info for you to be able to help. Many thanks Steve H

Answer Wiki

Thanks. We'll let you know when a new response is added.

Steve,

What happens when you step through the code at the point of showing the form?

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • BeerMaker
    With on error resume next you wont see the error code. you need to setup an error trap to display the error message. it should look like this: public sub MySub() on error goto ErrorTrap 'App code goes here frmMyForm.show vbmodal exit sub ErrorTrap: msgbox "Error showing form:" & Error end sub
    0 pointsBadges:
    report
  • Mcp111
    Try form.repaint or the RedrawWindow API
    0 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following