New Form call from Inherited Form

  • Thread starter Thread starter John A. Prejean
  • Start date Start date
J

John A. Prejean

This one has me stumped. I have a base form I am trying to wrap up, but I
have one problem. In two functions I am opening a "record detail" form. I
would like to keep the code in the base form and pass info to the form
telling it which from to actually open. Any ideas how to do this? Here is
an example of what I had in mind if the text isn't clear enough...

Base Form

Function EditRecord()
Dim frmRecord as New Form()
frmRecord.Filter = "ID = 2"
frmRecord.Show()
End Function

In the non inherited version of my form, I can easily declare the frmRecord
variable as the actual form needed to view the detail. But I want the
frmRecord to take on the attibutes of Form_Employee_Detail, or
Form_Invoice_Detail, or Form_Transaction_Detail, etc. I think you get the
idea.

Any help would be greatly appreciated! Thanks!

John A. Prejean
(e-mail address removed)
 
Any instance of a derived type can be set back to a variable of the base
type. As long as the ID that you want to filter on is the same between all
derived forms, you can do this. Use the derived form's constructor to set
the filter criteria for the record

Class Employee_detail_Form
inherits BaseForm

sub new()
frmRecord.Filter = "ID = 2"
end sub


end class

Class BaseForm
Function EditRecord()
Dim frmRecord as New Form()
frmRecord.Show()
End Function
end Class
--------------------
 
Couldnt you just expose the entire form.

Private mfrm_RecordForm as RecordFormType = new RecordFormType

BaseForm
Public Readonly Property RecordForm()as RecordFormType
return mfrm_RecordForm
End Property
End BaseForm

then inside anyother classes you would use (baseform.recordform.filter = "ID
= 2")

Bryan Martin
(e-mail address removed)
 
The problem is the form I am trying to open is neither the derived nor base
form. This is what I have...

Class Employee_Detail_Form
....
End Class

Class Invoice_Detail_Form
....
End Class

Class BaseListForm
Function EditRecord()
?? Dim frmRecord as New Employee_Detail_Form()
?? Dim frmRecord as New Invoice_Detail_Form()
frmRecord.Show
End Function
End Class

Class EmployeeListForm
Inherits BaseListForm

''' When call is made from this form, I want it to use
Employee_Detail_Form
End Class

Class InvoiceListForm
Inherits BaseListForm

''' When call is made from this form, I want it to use
Invoice_Detail_Form
End Class


How can I get the call to be a variable that can change based on a
parameter. I already have it setup to override certain functions. But I
could really clean up the processes if I can get past this hurdle.

Thanks!!!
 
Back
Top