473,383 Members | 1,717 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Toolbar and mdi child forms

I have a MDI Parent form with a toolbar that has a Next and Previous button
on it.

I open up a MDI Child form, that has two routines, called nextrec and
prevrec.

When I hit the Next or Previous button on the parent window, I want the
corresponding routine (nextrec/prevrec) on the child form to fire.

How is this done in VB.NET 2003 ???

TIA.

Jamie.
Nov 20 '05 #1
12 3057
This assumes that nextrec and prevrec are public methods

private void next_Click(object sender, EventArgs e) // handler for "Next" butto

((MyChildForm)ActiveMdiChild).nextrec()
private void prev_Click(object sender, EventArgs e) // handler for "Previous butto

((MyChildForm)ActiveMdiChild).prevrec()

Nov 20 '05 #2
This assumes that nextrec and prevrec are public methods

private void next_Click(object sender, EventArgs e) // handler for "Next" butto

((MyChildForm)ActiveMdiChild).nextrec()
private void prev_Click(object sender, EventArgs e) // handler for "Previous butto

((MyChildForm)ActiveMdiChild).prevrec()

Nov 20 '05 #3
Unfortunately, this does not work in VB.

How do you create a reference to a type from the ActiveMdiChild
properties ???,
instead of issuing Dim myChildForm As members

Since I have many child forms, it does not make sense to add each form
to the prev/next button click events.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #4
Unfortunately, this does not work in VB.

How do you create a reference to a type from the ActiveMdiChild
properties ???,
instead of issuing Dim myChildForm As members

Since I have many child forms, it does not make sense to add each form
to the prev/next button click events.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #5
"Jamie Di Natale" <ja***@s-d-x.com> schrieb
I have a MDI Parent form with a toolbar that has a Next and Previous
button on it.

I open up a MDI Child form, that has two routines, called nextrec
and prevrec.

When I hit the Next or Previous button on the parent window, I want
the corresponding routine (nextrec/prevrec) on the child form to
fire.

How is this done in VB.NET 2003 ???


If typeof me.activemdichild is MyChildClass then
directcast(me.activemdichild, MyChildClass).nextrec
end if
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #6
"Jamie Di Natale" <ja***@s-d-x.com> schrieb
I have a MDI Parent form with a toolbar that has a Next and Previous
button on it.

I open up a MDI Child form, that has two routines, called nextrec
and prevrec.

When I hit the Next or Previous button on the parent window, I want
the corresponding routine (nextrec/prevrec) on the child form to
fire.

How is this done in VB.NET 2003 ???


If typeof me.activemdichild is MyChildClass then
directcast(me.activemdichild, MyChildClass).nextrec
end if
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #7
'MainScreen with toolbar
Dim membersMDIChild As New members
membersMDIChild.MdiParent = Me
membersMDIChild.Show()

NextRec_Click....

If typeof me.activemdichild is members then
directcast(me.activemdichild, members).nextrec
end if

Since, I have multiple mdichild's, how can I change class members, to
what ever the class is of the activeform instead of explicitly typing it
in ???

So, when you click on the next button on the toolbar of the parent form,
it does the public sub nextrec of the activemdichild form.

In Visual FoxPro, all I have to do is call _screen.activeform.nextrec().

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #8
'MainScreen with toolbar
Dim membersMDIChild As New members
membersMDIChild.MdiParent = Me
membersMDIChild.Show()

NextRec_Click....

If typeof me.activemdichild is members then
directcast(me.activemdichild, members).nextrec
end if

Since, I have multiple mdichild's, how can I change class members, to
what ever the class is of the activeform instead of explicitly typing it
in ???

So, when you click on the next button on the toolbar of the parent form,
it does the public sub nextrec of the activemdichild form.

In Visual FoxPro, all I have to do is call _screen.activeform.nextrec().

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #9
I apologize. Sometimes I forget which forum I'm in

CType(Me.ActiveMsiChild, members).nextrec()

It's the same as what you're used to in FoxPro, except that you need to cast the form returned by Me.ActiveMdiChild to the type that contains the definition for nextrec

Charlie
Nov 20 '05 #10
I apologize. Sometimes I forget which forum I'm in

CType(Me.ActiveMsiChild, members).nextrec()

It's the same as what you're used to in FoxPro, except that you need to cast the form returned by Me.ActiveMdiChild to the type that contains the definition for nextrec

Charlie
Nov 20 '05 #11
"Jamie Di Natale" <ja***@s-d-x.com> schrieb
'MainScreen with toolbar
Dim membersMDIChild As New members
membersMDIChild.MdiParent = Me
membersMDIChild.Show()

NextRec_Click....

If typeof me.activemdichild is members then
directcast(me.activemdichild, members).nextrec
end if

Since, I have multiple mdichild's, how can I change class members,
to what ever the class is of the activeform instead of explicitly
typing it in ???

So, when you click on the next button on the toolbar of the parent
form, it does the public sub nextrec of the activemdichild form.


I guess the child forms have all different types, but the method names are
the same (nextrec...), right? There are two "clean" ways:

- Derive your child forms from the same base form. The base form contains
the common procedure, so you can write directcast(me.activemdichild,
commonform).nextrec

- Write and interface containing the common members and implement it in all
childs capable of this set of members. It's pretty easy to do. Code would
be: directcast(me.activemdichild, ICommoninterface).nextrec
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #12
"Jamie Di Natale" <ja***@s-d-x.com> schrieb
'MainScreen with toolbar
Dim membersMDIChild As New members
membersMDIChild.MdiParent = Me
membersMDIChild.Show()

NextRec_Click....

If typeof me.activemdichild is members then
directcast(me.activemdichild, members).nextrec
end if

Since, I have multiple mdichild's, how can I change class members,
to what ever the class is of the activeform instead of explicitly
typing it in ???

So, when you click on the next button on the toolbar of the parent
form, it does the public sub nextrec of the activemdichild form.


I guess the child forms have all different types, but the method names are
the same (nextrec...), right? There are two "clean" ways:

- Derive your child forms from the same base form. The base form contains
the common procedure, so you can write directcast(me.activemdichild,
commonform).nextrec

- Write and interface containing the common members and implement it in all
childs capable of this set of members. It's pretty easy to do. Code would
be: directcast(me.activemdichild, ICommoninterface).nextrec
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #13

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

Similar topics

4
by: JesusFreak | last post by:
From: us_traveller@yahoo.com (JesusFreak) Newsgroups: microsoft.public.scripting.jscript Subject: toolbar script problem NNTP-Posting-Host: 192.92.126.136 Recently, I downloaded the following...
0
by: Bill Gates | last post by:
Anyone have a good location for samples using the Parent window toolbar with MDI child forms?
0
by: AliR | last post by:
Hi everyone, I am writing an MDI application, and I just learned how to merge my child form's menu with the parent, so I can handle the menu notifications with in the child form. Now I want to...
12
by: Jamie Di Natale | last post by:
I have a MDI Parent form with a toolbar that has a Next and Previous button on it. I open up a MDI Child form, that has two routines, called nextrec and prevrec. When I hit the Next or...
3
by: Ellis Yu | last post by:
Dear all, I want to have a toolbar in the main (central) form of an MDI application. All child forms have 5 common buttons for specific jobs like SAVE, NEW etc. So when the user is in the child...
1
by: Sudhakara.T.P. | last post by:
Hi All, I have an Windows Application in which I have an MDI form and some child forms. I am assigning the parent window for the child forms using the code frmTest1.mdiparent=me Now in the...
3
by: Smiles | last post by:
Hi there. Thanks for help in advance. I have an mdi form, with a toolbar. When i click on the toolbar button, i want to call the sub of "active mdi child" form's "Action" module, with the...
1
by: Alfredo Barrientos | last post by:
Hi, I have a little trouble trying to assign a Toolbar control to another toolbar variable control. I am getting my forms controls with this: for (int j = 0; j <= frmChild.Controls.Count -...
0
by: wayne | last post by:
Hi, Has anyone been able to show MDI child windows in the content area when using a tool strip manager? The problem I have is if I place a toolstrip manager on the MDI parent then create a set...
0
by: Ryan Liu | last post by:
Hi, I have this inconsistent problem for days and really get me exhausted. I have a user control with a datagrid, a small toolbar, a label and a text box on it. Toolbar has buttons to...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.