473,511 Members | 15,408 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with Controls in an MDI Application

The problem that I am now having, involves refreshing controls. I have allot of text boxes, several combo boxes and grids. These controls are showing live data from an Oracle database. I have dates in a combo box in my tool bar that are associated with the particular report that the user is opening. When the user picks a different date all of the data in the controls should reload. I originally built an SDI application but needed my tool bar to stay put so I redid it in MDI. In the SDI application when the user chooses a new date in the combo box, an event handler calls my load function and all of the data in the controls in reloaded with new data. In the MDI application, the new data does not show up unless I close and re show the MDI child. This of course makes the application too slow and is unacceptable. Also, I am having another problem with a control. This control is on the parent and is the dates combo box that I mentioned above. If a user clicks new report a dialog with a date time picker pops up and the user is able to select a date for the report and say OK. At this point the new date is to be inserted into the combo box (combobox.Items.Add(string)) as this happens the index of the new item is captured and the combo box is set to the new date. In the MDI application this does not happen. The combo box does not receive the new date. In fact, if I try to get a count of the items in the combo box within this event handler or a separate function, it comes back as zero, even though I can see that there are items in the list. In the SDI application, none of these problems exist. I have tried several different ways to get around this problem, and have shared it with the other developers on my team; we are all stumped. Has anyone ever seen this before? How can I fix it?
Nov 16 '05 #1
4 2329
Hi John,
"John Tyce" <jt***@chevrontexaco.com> wrote in message news:Oa**************@TK2MSFTNGP15.phx.gbl...
The problem that I am now having, involves refreshing controls. I have allot of text boxes, several combo boxes and grids. These controls are showing live data from an Oracle database. I have dates in a combo box in my tool bar that are associated with the particular report that the user is opening. When the user picks a different date all of the data in the controls should reload. I originally built an SDI application but needed my tool bar to stay put so I redid it in MDI. In the SDI application when the user chooses a new date in the combo box, an event handler calls my load function and all of the data in the controls in reloaded with new data. In the MDI application, the new data does not show up unless I close and re show the MDI child. This of course makes the application too slow and is unacceptable.
It's not clear (to me) how your application interface is structured. SDI and MDI are very different interface styles. MDI implies multiple child forms open at one time. It sounds like the toolbar/combo box is on the MDI parent form. Does the combo box need to update multiple child forms at once...or only the active child form...or maybe you are assuming that only one child form will ever be open?

Basically, you need to make the "Load" method of the MDI child form public. Then, in the event handler of the combo box, you need to iterate through the MdiChildren collection of the MDI parent form and identify the child form(s) that need(s) updating and call the Load method on that (those) form(s).

...
foreach(Form form in this.MdiChildren)
{
MyChildForm myChildForm = form as MyChildForm;

if (myChildForm != null) myChildForm.Load(...);
}
...
Also, I am having another problem with a control. This control is on the parent and is the dates combo box that I mentioned above. If a user clicks new report a dialog with a date time picker pops up and the user is able to select a date for the report and say OK. At this point the new date is to be inserted into the combo box (combobox.Items.Add(string)) as this happens the index of the new item is captured and the combo box is set to the new date. In the MDI application this does not happen. The combo box does not receive the new date. In fact, if I try to get a count of the items in the combo box within this event handler or a separate function, it comes back as zero, even though I can see that there are items in the list. In the SDI application, none of these problems exist. I have tried several different ways to get around this problem, and have shared it with the other developers on my team; we are all stumped. Has anyone ever seen this before? How can I fix it?
Things rarely "just don't work". Are you certain that you are always dealing with the same combo box? Is it possible that the combo box is getting cleared before you retrieve items from it. Can you post the routines that add and retrieve items from the combo box?

Regards,
Daniel

P.S. It usually is a good idea to post messages to newsgroups in "plain text" rather than html.
Nov 16 '05 #2
Yeah, there only one child. I made the application and MDI because there are allot of controls on the form and the user does not want tabs. Because of this the user has to scroll up/down and back/forth in order to see and access all of the controls. As an SDI application, if the user was in the bottom right corner of the application and wanted to save a change, they had to scroll back up and over to hit the save button. I needed to tool bar to always be visible, so I put the save,new report, and print buttons on a tool bar in on the parent form. Now they can scroll around and the toolbar stays put. There are no other children and the load function is public. What I would really like is a tool bar that would float at the top as it does now, but on an SDI application (a floating tool bar that stays put).

--
JOHN TYCE
"Daniel Pratt" <ko******************@hotmail.com> wrote in message news:eB**************@tk2msftngp13.phx.gbl...
Hi John,
"John Tyce" <jt***@chevrontexaco.com> wrote in message news:Oa**************@TK2MSFTNGP15.phx.gbl...
The problem that I am now having, involves refreshing controls. I have allot of text boxes, several combo boxes and grids. These controls are showing live data from an Oracle database. I have dates in a combo box in my tool bar that are associated with the particular report that the user is opening. When the user picks a different date all of the data in the controls should reload. I originally built an SDI application but needed my tool bar to stay put so I redid it in MDI. In the SDI application when the user chooses a new date in the combo box, an event handler calls my load function and all of the data in the controls in reloaded with new data. In the MDI application, the new data does not show up unless I close and re show the MDI child. This of course makes the application too slow and is unacceptable.
It's not clear (to me) how your application interface is structured. SDI and MDI are very different interface styles. MDI implies multiple child forms open at one time. It sounds like the toolbar/combo box is on the MDI parent form. Does the combo box need to update multiple child forms at once...or only the active child form...or maybe you are assuming that only one child form will ever be open?

Basically, you need to make the "Load" method of the MDI child form public. Then, in the event handler of the combo box, you need to iterate through the MdiChildren collection of the MDI parent form and identify the child form(s) that need(s) updating and call the Load method on that (those) form(s).

...
foreach(Form form in this.MdiChildren)
{
MyChildForm myChildForm = form as MyChildForm;

if (myChildForm != null) myChildForm.Load(...);
}
...
Also, I am having another problem with a control. This control is on the parent and is the dates combo box that I mentioned above. If a user clicks new report a dialog with a date time picker pops up and the user is able to select a date for the report and say OK. At this point the new date is to be inserted into the combo box (combobox.Items.Add(string)) as this happens the index of the new item is captured and the combo box is set to the new date. In the MDI application this does not happen. The combo box does not receive the new date. In fact, if I try to get a count of the items in the combo box within this event handler or a separate function, it comes back as zero, even though I can see that there are items in the list. In the SDI application, none of these problems exist. I have tried several different ways to get around this problem, and have shared it with the other developers on my team; we are all stumped. Has anyone ever seen this before? How can I fix it?
Things rarely "just don't work". Are you certain that you are always dealing with the same combo box? Is it possible that the combo box is getting cleared before you retrieve items from it. Can you post the routines that add and retrieve items from the combo box?

Regards,
Daniel

P.S. It usually is a good idea to post messages to newsgroups in "plain text" rather than html.
Nov 16 '05 #3
Hi John,
"John Tyce" <jt***@chevrontexaco.com> wrote in message news:eS**************@TK2MSFTNGP15.phx.gbl...
Yeah, there only one child. I made the application and MDI because there are allot of controls on the form and the user does not want tabs. Because of this the user has to scroll up/down and back/forth in order to see and access all of the controls. As an SDI application, if the user was in the bottom right corner of the application and wanted to save a change, they had to scroll back up and over to hit the save button. I needed to tool bar to always be visible, so I put the save,new report, and print buttons on a tool bar in on the parent form. Now they can scroll around and the toolbar stays put. There are no other children and the load function is public. What I would really like is a tool bar that would float at the top as it does now, but on an SDI application (a floating tool bar that stays put).
Add a new form to the project. Add a toolbar to the form (it should dock to the top automatically). Add a panel to the form. Set the Dock property of the panel to "Fill" and set the AutoScroll property of the panel to "True". Put the controls within the panel.

Regards,
Daniel
Nov 16 '05 #4
That is exactly what I wanted. Thanks Daniel.

--
JOHN TYCE
"Daniel Pratt" <ko******************@hotmail.com> wrote in message news:OZ**************@TK2MSFTNGP10.phx.gbl...
Hi John,
"John Tyce" <jt***@chevrontexaco.com> wrote in message news:eS**************@TK2MSFTNGP15.phx.gbl...
Yeah, there only one child. I made the application and MDI because there are allot of controls on the form and the user does not want tabs. Because of this the user has to scroll up/down and back/forth in order to see and access all of the controls. As an SDI application, if the user was in the bottom right corner of the application and wanted to save a change, they had to scroll back up and over to hit the save button. I needed to tool bar to always be visible, so I put the save,new report, and print buttons on a tool bar in on the parent form. Now they can scroll around and the toolbar stays put. There are no other children and the load function is public. What I would really like is a tool bar that would float at the top as it does now, but on an SDI application (a floating tool bar that stays put).
Add a new form to the project. Add a toolbar to the form (it should dock to the top automatically). Add a panel to the form. Set the Dock property of the panel to "Fill" and set the AutoScroll property of the panel to "True". Put the controls within the panel.

Regards,
Daniel
Nov 16 '05 #5

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

Similar topics

3
2529
by: michael haller | last post by:
In my project i have a textfile witch i import in my c# application. The datas in the textfile i show the datas in the textfile in my datagrid..ok that ist not my problem. Now i have a...
1
4004
by: Rhy Mednick | last post by:
I'm creating a custom control (inherited from UserControl) that is displayed by other controls on the form. I would like for the control to disappear when the user clicks outside my control the...
4
2952
by: waltborders | last post by:
Hi, Because the blind are unable to use a mouse, keyboard navigation is key. A major difficulty is that not all windows forms controls are keyboard 'tab-able' or 'arrow-able' or have "tab...
0
1751
by: Adrian Belen via .NET 247 | last post by:
hi, I have a problem when I try to open an excel document in a AxWebBrowser Component in VB.NET. The problem appear in this situation: Before to all the Excel application is opened from the...
10
3984
by: Charles Law | last post by:
For some reason, when I click the X to close my MDI parent form, the action appears to be re-directed to one of the MDI child forms, and the parent remains open. I am then unable to close the...
5
4062
by: Segfahlt | last post by:
I need a little help here please. I have 2 win forms user controls in 2 different projects that I'm hosting in 2 different virtual directories. The controls have been test and operate okay in...
14
3334
by: =?Utf-8?B?UHVjY2E=?= | last post by:
Hi, I'm using VS2005 and .net 2.0. I'm creating an application that has 3 forms. I want allow users to move forward and backward with the forms and retain the data users have entered. I thought...
4
2625
by: Goran Djuranovic | last post by:
Hi all, I am experiencing a strange thing happening with a "designer.vb" page. Controls I manually declare in this page are automatically deleted after I drop another control on a ".aspx" page. -...
3
5293
by: Gerrit | last post by:
Hi, I try to learn programming in c# with databinding controls. Now I have a problem with a ComboBox with the advanced properties for databinding, I want to set the DataSourceUpdateMode to...
0
7138
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
7418
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...
1
5063
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...
0
4737
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...
0
3222
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...
0
3212
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1572
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 ...
1
781
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
446
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...

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.