?
Solved

Updating a DataSet

Posted on 2005-03-29
2
Medium Priority
?
277 Views
Last Modified: 2010-04-23
I'm working with datatables in a dataset.  I'm getting the info into a from made up of text boxes with a function with statements like this textbox1.text = dRow("name")....etc.

Now I want to update fields.  So I understand that I need the textbox_changed function.  But I don't know how to do that.  How would be able to modify/edit the data and get it back into the database?  Please provide a example.

Thanks in advance.
0
Comment
Question by:tobin46
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 9

Accepted Solution

by:
Lacutah earned 500 total points
ID: 13658497
Sounds like you're doing it the "re-invent the wheel" way.  Visual Basic .NET provides for datbinding in forms, makes what your trying to do so much easier - changes to text box automatically make it back to the underlying datatables.

Here's a quick introduction:
http://www.codeproject.com/vb/net/databindingconcepts.asp
0
 
LVL 9

Expert Comment

by:Lacutah
ID: 13658529
Quick Example:

Pretend I have a DataTable called "dtEmployees" (the table may or may not reside in a dataset - doesn't matter...)
I also have a form with two text boxes, one called txtFirstName, and one called txtLastName...

In the form_load event, I would:
      ... Fill the Datatable here with data...
      'Configure txtFirstName...
      txtFirstName.DataBindings.Add("text", dtEmployees, "FirstName")
      'Configure txtLastName
      txtLastName.DataBindings.Add("text", dtEmployees, "LastName")

Walla!  Data is bound!

To navigate the data, use a BindingManagerBase object:
Sub BtnNext_Press(sender as object, e as event args)
       Dim bmb As BindingManagerBase = Me.BindingContext(dtEmployees)
       if bmb.Count -1 > bmb.Position then bmb.Position += 1
end Sub
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

741 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question