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 2004

Tip: Looking for answers? Try searching our database.

DataBinding Text boxes on a form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dani - 15 Oct 2004 12:31 GMT
I've put some text boxes on a form, and a combobox.
bind them all to a dataset which I created (simple dataset, but have a join
in the select)
created teh update and insert commands manually
binded then texts box to the appropriate coloumns.
then added to the combobox change event:
              index = cbxStudentID.SelectedIndex;
              this.BindingContext[dsStudents1,"Students"].Position = index;
which makes all the text boxes sync with the current selection of the
combobox.
my problem is getting the changes I make in the text box go back to the
database.
I added a button, that upon clicked - runs:
da.update(dsStudents1,"Students")

when I clicked it, it tried to INSERT the rows to the database and ofcourse
failed on PK constraint.
I figured out all the row are in DataRowState.Added for some reason, so I
added an accept changed right after the fill to remove that.

but now nothing happens when I hit the update.
I've tried to enter the row to beginedit mode and then endedit each time the
combo is changed (and again last time when the button clicked) but the second
I use endedit on a row, all my changes dissapear.

I don't know how to do it right, hope someone can help me.
Regards,
Dani.
Sijin Joseph - 18 Oct 2004 05:18 GMT
Tyr calling EndCurrentEdit() on all the textboxes before calling da.Update()

Sijin Joseph
http://www.indiangeek.net
http://weblogs.asp.net/sjoseph

> I've put some text boxes on a form, and a combobox.
> bind them all to a dataset which I created (simple dataset, but have a join
[quoted text clipped - 24 lines]
> Regards,
> Dani.

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.