Windows Develop Bookmark and Share   
 index > Windows Forms General > Updating Multiple Data Set
 

Updating Multiple Data Set

Hi,
Uses: VS 2005;.NET 2.0;Window XP;Oracle+9i;ODP.NET

I need to have a generic method of updating datasets in a Form, where I can use it in all business forms.

In delphi, I do the following in the parent form, and call this in all child form which updates forms having multiple datasets.

Fori:=0toForm.Component.Count-1do
begin
IfForm.Component[i]isTTableThen
Form.Component[i].Post;
end;

How can I do a similar in a .NET parent form and call it in all child forms.

Thanks & Regards,

Hifni
Hifni Shahzard Nazeer M.
_Hifni  Friday, March 06, 2009 10:29 AM
EVENTS & DELEGATES!

It sounds like you need to define an object defined by or in theparent formthat all of the child forms share, or subscribe to the events the object publishes.

So now your loop simply does this.

EventObject eventObject; // initialize it in parent form somewhere....constructor!

for(int i=0; i< Count; i++)
{
eventObject.Invoke();
}

That would be it. Any subscribers would automatically get notified. Which .NET language?

Rudedog =8^D
Mark the best replies as answers. "Fooling computers since 1971."
Rudedog2  Friday, March 06, 2009 9:25 PM
I've not had to address this particular problem in .NET but here's a link that might give you a clue as to one possible way to do it:

http://bytes.com/groups/net-c/545315-list-all-controls-inside-each-form

Another alternative might be adding your datasets to a list member (an array) for the base form class you're using and build in support for calling each list member's .Commit method. You'd have some hand-wiring code involved for each descendant form, of course (i.e. adding each specific dataset to the list on the form's load, etc.) but you could code the actual method of iterating through the form's 'dataset list' and posting changes just once (in the base form).

Good luck.
TomCat42  Friday, March 06, 2009 9:05 PM
EVENTS & DELEGATES!

It sounds like you need to define an object defined by or in theparent formthat all of the child forms share, or subscribe to the events the object publishes.

So now your loop simply does this.

EventObject eventObject; // initialize it in parent form somewhere....constructor!

for(int i=0; i< Count; i++)
{
eventObject.Invoke();
}

That would be it. Any subscribers would automatically get notified. Which .NET language?

Rudedog =8^D
Mark the best replies as answers. "Fooling computers since 1971."
Rudedog2  Friday, March 06, 2009 9:25 PM

You can use google to search for other answers

Custom Search

More Threads

• Integrateionof help file into windows application
• question about getpixel
• Ways to prevent users
• MDI Child maximise
• UserControl resizing in a container
• datagrid stubbornly displays wrong popup menu
• When or should I dispose a BackgroundWorker component?
• treeView1.SelectedNode.ForeColor
• creating mail from .net application
• Web browser problem