473,587 Members | 2,324 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Toolbar in a MDI Application

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 form1 and press the toolbar
button SAVE in the toolbar of main form, then the program will save the data
of child form 1only. Generally the buttons of the toolbar will do the job of
the child form which has the focus (activation) and when there is no child
form open then probably they will be disable. Please help. Thanks.

Best Rdgs
Ellis
Nov 21 '05 #1
3 1737
The ActiveMdiChild of the MDI form tells you which is the active MDI child
form. I would recomend to define an interface like IMDIChildWindow with
methods CanSave, Save, etc. so the MDI Parent can query or invoke those
methods implemented by MDI child windows.

--

Carlos J. Quintero

MZ-Tools 4.0: Productivity add-ins for Visual Studio .NET
You can code, design and document much faster.
http://www.mztools.com
"Ellis Yu" <el******@trans field.com> escribió en el mensaje
news:em******** ********@TK2MSF TNGP15.phx.gbl. ..
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 form1 and press the
toolbar
button SAVE in the toolbar of main form, then the program will save the
data
of child form 1only. Generally the buttons of the toolbar will do the job
of
the child form which has the focus (activation) and when there is no child
form open then probably they will be disable. Please help. Thanks.

Best Rdgs
Ellis

Nov 21 '05 #2
Thanks for your help. But I'm still don't understand how to use
interface for invoking the action for different child windows. Would you
please kindly give me some sample code for this? Many thanks.
"Carlos J. Quintero [.NET MVP]" <ca*****@NOSPAM sogecable.com> wrote in
message news:#v******** ******@TK2MSFTN GP15.phx.gbl...
The ActiveMdiChild of the MDI form tells you which is the active MDI child
form. I would recomend to define an interface like IMDIChildWindow with
methods CanSave, Save, etc. so the MDI Parent can query or invoke those
methods implemented by MDI child windows.

--

Carlos J. Quintero

MZ-Tools 4.0: Productivity add-ins for Visual Studio .NET
You can code, design and document much faster.
http://www.mztools.com
"Ellis Yu" <el******@trans field.com> escribió en el mensaje
news:em******** ********@TK2MSF TNGP15.phx.gbl. ..
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 form1 and press the
toolbar
button SAVE in the toolbar of main form, then the program will save the
data
of child form 1only. Generally the buttons of the toolbar will do the job of
the child form which has the focus (activation) and when there is no child form open then probably they will be disable. Please help. Thanks.

Best Rdgs
Ellis


Nov 21 '05 #3
Public Interface IMDIChild
Function CanSave() As Boolean
End Interface

Public Class Form1
Inherits System.Windows. Forms.Form

#Region " Windows Form Designer generated code "
....
#End Region

Implements IMDIChild
Public Function CanSave() As Boolean Implements IMDIChild.CanSa ve
Return True
End Function

End Class

Public Class Form2
Inherits System.Windows. Forms.Form
Implements IMDIChild

#Region " Windows Form Designer generated code "
....
#End Region

Public Function CanSave() As Boolean Implements IMDIChild.CanSa ve
Return False
End Function

End Class

Public Class MDIForm
Inherits System.Windows. Forms.Form

#Region " Windows Form Designer generated code "
....
#End Region

Private Sub MDIForm_Load(By Val sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load

Dim f As Form

f = New Form1
f.MdiParent = Me
f.Show()

f = New Form2
f.MdiParent = Me
f.Show()

End Sub

Private Sub MDIForm_MdiChil dActivate(ByVal sender As Object, ByVal e As
System.EventArg s) Handles MyBase.MdiChild Activate

Dim frm As Form
Dim objIMDIChild As IMDIChild

frm = Me.ActiveMdiChi ld

Me.Text = "Can not save"

If Not (frm Is Nothing) Then
If TypeOf frm Is IMDIChild Then
objIMDIChild = DirectCast(frm, IMDIChild)
If objIMDIChild.Ca nSave Then
Me.Text = "Can save"
End If
End If
End If

End Sub

End Class
--

Carlos J. Quintero

MZ-Tools 4.0: Productivity add-ins for Visual Studio .NET
You can code, design and document much faster.
http://www.mztools.com
"Ellis Yu" <el******@trans field.com> escribió en el mensaje
news:ej******** ******@TK2MSFTN GP15.phx.gbl...
Thanks for your help. But I'm still don't understand how to use
interface for invoking the action for different child windows. Would you
please kindly give me some sample code for this? Many thanks.


Nov 21 '05 #4

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

Similar topics

2
9704
by: PK | last post by:
Hello, I am looking for help on the following. I'm trying to create a custom browser toolbar button that will do a few things. One that I'm trying to do at the moment is just simply return the URL of whatever page the user is visiting. I wanted to create a Win32 application using VB.NET. If there is a better way of doing this please let...
102
7316
by: me | last post by:
How do I prevent the save/print/email/mypictures toolbar from popping up when IE users place their cursor over photos at my website? Thank you in advance for your help. Signed, me
1
2062
by: Lauren Quantrell | last post by:
I'm trying to extract the name of a toolbar object in order to execute Help files based the object in the toolbar. I'm using the following code if I know the name of the toolbar object: Dim objBar As CommandBar Dim myHelpContextID as integer Set objBar = Application.CommandBars("myToolbarName") myHelpContextID =...
0
1795
by: Lauren Quantrell | last post by:
I use the following code to create text edit fields and command buttons in my toolbars: Function CreateToolbarObject(myObjectType as integer) Dim newObject Select Case myObjectType Case 1 'text Set newObject =
0
1277
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 add a toolbar to my application, and I want to process the notification messages from the toolbar within my active child form. Is there a way to...
5
3231
by: anthony.duerr | last post by:
I have encountered a problem (most certainly a .NET bug), that, for the life of me, I cannot figure out how to work around. Using Visual Studio 2003, with enabled XP Visual Styles. There are two possible scenarios here, the first one works properly, while the 2nd one doesn't. Scenario 1 ----------
5
2218
by: Bernie Yaeger | last post by:
I use application.enablevisualstyles() and develop using visual studio 1.1. I know that changing flatstyle for certain controls will give me xp styles on those controls. However, I don't know how to get the xp look and feel for toolbar buttons. Mine highlight as I pass over them, but they are not 3d and do not change shades, as do for...
3
5242
by: Undergrid | last post by:
Hi All, I've got a few toolbars in my application hosted in a ToolStripContainer. I have found a problem whereby the location of a toolbar is not restored when doing a LoadSettings if the toolbar is in the same ToolStripPanel as specified in the settings. For example, create a toolbar in ToolStripContainer.TopToolStripPanel and save...
6
3887
by: =?Utf-8?B?L2Rldi9udWxs?= | last post by:
Hello, i am using visual studio 2003 enterprise architect version. I am making apps for the .Net framework 1.1. While testing an interface, i discovered something strange. In this application we have a standard toolbar that is at the top of the form window. It contains about 8 buttons that use images from an imagelist. Sometimes we hide...
10
5437
by: rmurgia | last post by:
We have set up a function as listed below to display a custom toolbar used to export data from the report. The function is called from the open event of each report: Function CBShowPrint() Application.CommandBars("BranchPrint").Enabled = True Application.CommandBars("BranchPrint").Visible = True End Function We recently...
0
7843
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8206
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. ...
1
7967
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...
0
8220
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...
1
5713
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5392
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...
1
2353
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
1
1452
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1185
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...

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.