Dataset,reference, parameters?

  • Thread starter Thread starter Matej Kavèiè
  • Start date Start date
M

Matej Kavèiè

Hello,
Iam newbie, I want to ask some basic question. I come from Delphi world. In
Delphi I have DataModule where i put down all coonnection, datasets and
so...Is it posible and how can i do that in C#, I create new form and put on
sql Connection, datadapters and create datasets, so how can i now use this
datasets in other forms, i cannot find any examples on internet. also i
donn't know how to call some function in other forms, in delphi i call like
form2.DoSomething; how to do this in c#, please could somebody write few
line of code how to do this.

thanks
 
Hi Matej,

You can't share them within designer.
You'll have to pass references to another form.
 
Matej,
Normally what I do is to add a new Component (Project Add Component) to my
project, the put all the connection, adapters, commands and so on this new
component. I then add methods to the component to "simplify" the interface,
for example I may have a single Fill method that invokes Fill on all the
contained adapters...

Then from my Forms I can reference this component & use the part I need.

Note if you add the component to your form, each form will get a new
instance, its may be "better" to implement the Component as a singleton and
manually invoke the methods.

Using a Component gives you a visual designer without the overhead of an
actual form.

Hope this helps
Jay
 
Back
Top