Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > Buttons, RadioButton, CheckBox, etc > updating the dataset from TextBox

Not answered updating the dataset from TextBox

Feed from this thread
  • HASSAN avatar

    Posted on Jul 5, 2011 (permalink)

    i am new at this so it may be a stupid question !

    I have a dataset in VB.NET 2010 , i am getting the dataset using FillBy method , providing one parameter , 
     Try
                Me.daNatalog.FillBy(Me.DsPatients.Patients, txtPatkey.Text)
            Catch ex As System.Exception
                System.Windows.Forms.MessageBox.Show(ex.Message)
      End Try



    i want to update the underlying data with any changed data in any of the bound controls. 

    I am using one of the control as an example to understand this , its a radTextBox(txtEmail) whose databinding Text property is set to PatientBindingSource - email , DataSource Update mode is OnPropertyChanged 

    i add this code to update dataset , this only update first character or give me some error

    Private Sub txtEmail_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtEmail.TextChanged

            DsPatients.Tables(0).Rows(0)("e_mail") = txtEmail.Text.ToString
            daNatalog.Update(DsPatients.GetChanges())

        End Sub

    This code does not do anything.

    Private Sub txtEmail_Validated(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtEmail.Validated
            DsPatients.Tables(0).Rows(0)("e_mail") = txtEmail.Text.ToString
            daNatalog.Update(DsPatients.GetChanges())

        End Sub

    Please let me know how would i get this working 

    Thanks

    Reply

  • Julian Benkov Julian Benkov admin's avatar

    Posted on Jul 8, 2011 (permalink)

    Hi Hassan,

    You can try this solution to commit your changes to your DataTable object:

    Private Sub txtEmail_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtEmail.TextChanged
     
        DsPatients.Tables(0).Rows(0)("e_mail") = txtEmail.Text.ToString
        Dim editableObject As IEditableObject = TryCast(DsPatients.Tables(0).Rows(0), IEditableObject)
        If editableObject IsNot Nothing Then
            editableObject.EndEdit()
        End If
        daNatalog.Update(DsPatients.GetChanges())
     
    End Sub

    Do not hesitate to contact us if you have further questions or issues.

    Best wishes,
    Julian Benkov
    the Telerik team

    Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > Buttons, RadioButton, CheckBox, etc > updating the dataset from TextBox
Related resources for "updating the dataset from TextBox"

[ Features | Demos | Documentation | Knowledge Base | Telerik TV | Code Library | Step-by-step Tutorial | Blogs | Self-Paced Trainer ]