Displaying a form from a dll that resides in the dll
0 pts.
0
Q:
Displaying a form from a dll that resides in the dll
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
ASKED: Jan 26 2007  6:34 PM GMT
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
0
0 pts.
0
A:
 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0
  • AddThis Social Bookmark Button
Steve,

What happens when you step through the code at the point of showing the form?
Last Answered: Jan 31 2007  8:16 AM GMT by CharlesJC   0 pts.
0
0
Discuss This Answer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _



_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

BeerMaker   0 pts.  |   Jan 31 2007  9:21AM GMT

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

 

mcp111   0 pts.  |   Jan 31 2007  10:08AM GMT

Try form.repaint or the RedrawWindow API

 
0