473,773 Members | 2,286 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

New Form call from Inherited Form

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.Filte r = "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_D etail, or
Form_Invoice_De tail, or Form_Transactio n_Detail, etc. I think you get the
idea.

Any help would be greatly appreciated! Thanks!

John A. Prejean
jo**@gcit.net
Nov 20 '05 #1
3 1535
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.Filte r = "ID = 2"
end sub
end class

Class BaseForm
Function EditRecord()
Dim frmRecord as New Form()
frmRecord.Show( )
End Function
end Class
--------------------
From: "John A. Prejean" <jo**@gcit.ne t>
Subject: New Form call from Inherited Form
Date: Mon, 16 Feb 2004 12:47:13 -0600
Lines: 26
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <#h************ **@TK2MSFTNGP10 .phx.gbl>
Newsgroups: microsoft.publi c.dotnet.langua ges.vb
NNTP-Posting-Host: wsip-68-14-193-229.no.no.cox.n et 68.14.193.229
Path: cpmsftngxa07.ph x.gbl!cpmsftngx a06.phx.gbl!cpm sftngxa10.phx.g bl!TK2MSFTNGXA0 5
.phx.gbl!TK2MSF TNGP08.phx.gbl! TK2MSFTNGP10.ph x.gblXref: cpmsftngxa07.ph x.gbl microsoft.publi c.dotnet.langua ges.vb:181862
X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.vb

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.Filte r = "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_D etail, or
Form_Invoice_D etail, or Form_Transactio n_Detail, etc. I think you get the
idea.

Any help would be greatly appreciated! Thanks!

John A. Prejean
jo**@gcit.ne t


Nov 20 '05 #2
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.recor dform.filter = "ID
= 2")

Bryan Martin
sp**@ahwayside. com
"John A. Prejean" <jo**@gcit.ne t> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
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.Filte r = "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_D etail, or
Form_Invoice_De tail, or Form_Transactio n_Detail, etc. I think you get the
idea.

Any help would be greatly appreciated! Thanks!

John A. Prejean
jo**@gcit.net

Nov 20 '05 #3
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 EmployeeListFor m
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!!!

"Dot Net Team [MSFT]" <vb******@onlin e.microsoft.com > wrote in message
news:Uj******** ******@cpmsftng xa07.phx.gbl...
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.Filte r = "ID = 2"
end sub
end class

Class BaseForm
Function EditRecord()
Dim frmRecord as New Form()
frmRecord.Show( )
End Function
end Class
--------------------
From: "John A. Prejean" <jo**@gcit.ne t>
Subject: New Form call from Inherited Form
Date: Mon, 16 Feb 2004 12:47:13 -0600
Lines: 26
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <#h************ **@TK2MSFTNGP10 .phx.gbl>
Newsgroups: microsoft.publi c.dotnet.langua ges.vb
NNTP-Posting-Host: wsip-68-14-193-229.no.no.cox.n et 68.14.193.229
Path:

cpmsftngxa07.ph x.gbl!cpmsftngx a06.phx.gbl!cpm sftngxa10.phx.g bl!TK2MSFTNGXA0 5 phx.gbl!TK2MSFT NGP08.phx.gbl!T K2MSFTNGP10.phx .gbl
Xref: cpmsftngxa07.ph x.gbl microsoft.publi c.dotnet.langua ges.vb:181862
X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.vb

This one has me stumped. I have a base form I am trying to wrap up, but Ihave one problem. In two functions I am opening a "record detail" form. Iwould 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 isan example of what I had in mind if the text isn't clear enough...

Base Form

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

In the non inherited version of my form, I can easily declare the frmRecordvariable as the actual form needed to view the detail. But I want the
frmRecord to take on the attibutes of Form_Employee_D etail, or
Form_Invoice_D etail, or Form_Transactio n_Detail, etc. I think you get theidea.

Any help would be greatly appreciated! Thanks!

John A. Prejean
jo**@gcit.ne t

Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
6074
by: Paradox | last post by:
Hey, I'm trying to figure out what situations call for the use of a derived form control such as: public class myListBox : System.Windows.Forms.ListBox and what situations call for the use of a Custom User Control, generated by adding a new Custom User Control to a project with VS.NET.
0
1897
by: 42 | last post by:
I implemented a simple class inherited from Page to create a page template. It simply wraps some trivial html around the inherited page, and puts the inherited page into a form. The problem I have run into is that the emitted html at the end of the process is slightly different and doesn't work. Please don't be put off by all the source code. All the guts are in this first base class, and it doesn't do much. The rest is trivial...
13
2243
by: Lorne Smith | last post by:
Hi, First, sorry for the crosspost, but it seemed appropriate... :) I've come accross what I consider to be a bug, but I don't know if it's already known or not. (VS .Net 2003 Pro - VB.Net) Whilst playing with inherited forms, I created a simple base form containing a single button. I set this buttons' Click event to be public overridable and put "me.Close" in the code.
4
2653
by: JC Voon | last post by:
Hi: My base form has a button, when click it will call MessageBox.Show( "Base form" ). I inherite a child form from the base and assign a button click event to the same button which will call MessageBox.Show( "Inherited form" ). I run my application, and load the clild form, click the button it show both message !!! Is there any way to control the event sequence so that it only show the child form event, or i can control whether to...
4
3758
by: dbuchanan | last post by:
Is the following behavior normal? Both the 'Protected sub' in the inherited form and the 'Private Shadows sub' in the derived form fires. My interpretation of MSDN help on the topic "Shadows" does not seem to indicate that this is the designed behavior. (the topic is rather cryptic to me. Here is my code;
4
3159
by: Rod Gill | last post by:
Hi, I have a form that when opened in the designer appears of the screen. The form selector can't be dragged (or resized) and if I scroll right and down to centralise it the form simply jumps further away, completely leaving the selector box area. Any ideas? VS 2003 and VB.Net This is a simple application at the moment but the form is inherited from a
2
1755
by: Steve Teeples | last post by:
I have a simple form with a panel that is docked in the base form. The panel has three controls - two buttons and one treeview. I use "Inherited Form" when creating a second form derived from this parent form. The only thing is there are no controls in the inherited form. I made all the base controls "protected". What am I dong wrong? -- ----------- Thanks,
4
1947
by: asad.naeem | last post by:
hi to all this is the problem about inheritence. I have designed a form with some essential controls which are required for every form which will inherited from it. for example i have Button1 on parent form and this button is visible to me on inherited form. The problem is: I have written a click event of the button1 on both of the forms. tell me the way if i click the button on inherited form only parents' click event will be called and...
6
1879
by: Arkadiusz Smolak | last post by:
Hi, I need a help. I have form inherited from other form. The base form implementation is placed in other assembly. I try to open my inherited form in designer but visual studio throws an exception. My question is: "how can I debug visual studio form designer?" As I remember in Visual 6.0 it was possible by running two visual session and attaching first one to the second. Unfortunately in VS .NET 2005 it seems that it doesn't work. What...
0
10264
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10039
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9914
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6717
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5355
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5484
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4012
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2852
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.