473,387 Members | 1,844 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,387 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 3060
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...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...

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.