Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm Data Binding / October 2005

Tip: Looking for answers? Try searching our database.

Empty table

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Guy Pelletier - 26 Oct 2005 20:36 GMT
Hello everybody,

I have controls two tables in a dataset that are linked with a relation and all field are bind to control on a form.

When I navigate to a row in the parent table for wich there is no child, the binded text box are empty, as expected.  

When I put text in the controls corresponding to the child rows, I expected that the binding would automatically create a new row in wich to store the data but it does not to work.

Is it how it is supposed to work or should I programmatically create a new row ?

Thank's
Bart Mermuys - 27 Oct 2005 11:42 GMT
Hi,

>"Guy Pelletier" <Guy.Pelletier@cstjean.qc.ca> wrote in message
> >news:eLM2XSm2FHA.1188@TK2MSFTNGP12.phx.gbl...
[quoted text clipped - 9 lines]
> rows, I expected that the binding would automatically create
> a new row in wich to store the data but it does not to work.

>Is it how it is supposed to work or should I programmatically
>create a new row ?

You need to create a new row:

BindingContext[ DataSource, DataMember ].AddNew();

Note that DataSource and DataMember must be exactly the same as the ones you
used to bind the child controls.  DataMember should not include any
fieldname though.

eg.:
BindingContext[ dataSet, "MasterTable.ChildRelation"].AddNew();

HTH,
Greetings

>Thank's
Guy Pelletier - 27 Oct 2005 20:46 GMT
Hi,

It's what I tought but it's nice to have it confirmed.

Thank's for taking taking the time to answer my question.

Guy
>>> Bart Mermuys<bmermuys.nospam@hotmail.com> 27 Octobre 2005 06:42 >>>

Hi,

>"Guy Pelletier" <Guy.Pelletier@cstjean.qc.ca> wrote in message
> >news:eLM2XSm2FHA.1188@TK2MSFTNGP12.phx.gbl...
[quoted text clipped - 9 lines]
> rows, I expected that the binding would automatically create
> a new row in wich to store the data but it does not to work.

>Is it how it is supposed to work or should I programmatically
>create a new row ?

You need to create a new row:

BindingContext[ DataSource, DataMember ].AddNew();

Note that DataSource and DataMember must be exactly the same as the ones you
used to bind the child controls.  DataMember should not include any
fieldname though.

eg.:
BindingContext[ dataSet, "MasterTable.ChildRelation"].AddNew();

HTH,
Greetings

>Thank's

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.