[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

02/01/2008 at 05:08AM PST, ID: 23129347
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.2

Binding a dataset to textbox controls to update the dataset.

Asked by gazzacrowe in .NET, Microsoft Visual Basic.Net

Tags: Microsoft, VS2005, 2005, VB.NET 2005

Hi,
I am currently looking for away to manage updating data using a dataset and textboxes on a windows form.
Scenario:
1. I'm retrieving data from a database and populating a dataset with the results (about 10 rows of data in 1 table).
2. I am then binding the dataset to a datsgridView on the form. (All is good)
3. I have a few textboxes on the form and i bind a row to the text boxes. (ill include the code below)
4. As i click on the datagridview row the contents of that row will be displyed i the textboxes. (All is good). Everyclick of the row displays new data (i am using a BindingManagerBase here to iterate through the bindings)

What i would like to happen next:
Edit one of the textboxes and when the user leaves the textbox that the changes will get saved in the dataset and reflected in the datviewGrid.
The dataset is then passed to a function to update or create a new record (Note this is NOT being done through an SQLDataAdapter)

My take on this is that i've bound the textboxes to the grid, so would this be a one way binding ds -> textbox. Do i need a binding from textbox -> ds or is this handled in the binding.

I've been mssing with bindingsources as well.

Any help would be greatly apprciated.

Cheers
Steven

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
Dim manager As BindingManagerBase
Dim ds a new Dataset
 
Private Sub frm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
 
ds = Service.GetDetails(ID) 
DataGridView1.DataSource = dsTables(0)
 
BindDetails()
 
End Sub
 
Private Sub DataGridView1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataGridView1.Click
        Dim RowID As Integer
        Try
            RowID = DataGridView1.CurrentRow.Index
            manager.Position = RowID
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub
 
 Private Sub Textbox1_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Textbox1.Leave
 
        ds.AcceptChanges()
 
    End Sub
Private Sub BindDetails()
        Dim field1 As New Binding("Text", ds, "TableName.Field1")
        Dim field2 As New Binding("Text", ds, "TableName.Field2")
        manager = Me.BindingContext(ds, "TableName")
        Textbox1.DataBindings.Add(field1 )
        Textbox2.DataBindings.Add(field2 )
    End Sub
 
Keywords: Binding a dataset to textbox controls to…
 
Loading Advertisement...
 
[+][-]02/01/08 06:56 AM, ID: 20796979

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02/01/08 07:19 AM, ID: 20797176

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02/01/08 08:26 AM, ID: 20797930

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02/18/08 02:36 AM, ID: 20918852

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: .NET, Microsoft Visual Basic.Net
Tags: Microsoft, VS2005, 2005, VB.NET 2005
Sign Up Now!
Solution Provided By: gazzacrowe
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20091111-EE-VQP-91 / EE_QW_2_20070628