locked
BindingSource problem RRS feed

  • Question

  •  

    This is really confusing me.    Whats happening is, I have bound the bindingsource to a shared dataset which is fine.  Then I click on the botton to choose the customer I want.  but as soon as I press the button, the bindingsource goes back to the frist row... how do I stop this:

     

    Code:

    Code Snippet

     

    Private Sub FindCust_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    Me.CompaniesBindingSource.DataSource = CustomerDataSet.Tables("companies")

    Me.CompaniesBindingSource.ResetItem(0)

     

    End Sub

     

     

    Private Sub AcceptBT_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles AcceptBT.Click

    customerNo = CompanyIDTextBox.Text

    Order.CompanyIDTextBox.Text = CompanyIDTextBox.Text

    Order.CompanyNameTextBox.Text = CompanyNameTextBox.Text

    Order.OrderCustRoad.Text = CompanyRoadTextBox.Text

    Order.OrderCustCity.Text = CompanyCityTextBox.Text

    Order.OrderCustPostC.Text = CompanyPostCTextBox.Text

    Order.ordCustContact.Text = ContactNameTextBox.Text

    Order.ordCustTel.Text = ContactTelTextBox.Text

    On Error Resume Next

    Me.Close()

    End Sub

     

    if you can let me know, that would be really helpful, because I dont understand it.

     

     

    Saturday, April 12, 2008 5:30 PM

Answers

  • Hi Mr.Addy,

    I don't know how you choose the customer required based on the above code snippet. Commonly you can use BindingSource.Find method to get the index of the item in the list with the specified property name and value and set BindingSource.Position with this index to choose the user based on the specified information. Try it.

    Best regards,
    Riquel

    Thursday, April 17, 2008 8:19 AM
    Moderator