Solved

My DataRowState.Modified always when I fill data in winform and my Combobox is filled.

Posted on 2011-09-27
3
274 Views
Last Modified: 2012-05-12
I've a Combobox that loads date on fill. The may code is activated to do something. After that my DataRowState is always modified. Even if i didn't change the selectedrow of a combobox.

What kind of property do i need to use to get the DataRowState Modified and not when i fill the date on starting.

Hope you can help.
Private Sub ucboFromCompanyName_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ucboFromCompanyName.ValueChanged
        MaterialInwardBindingSource.Current("FromCompanyName") = ucboFromCompanyName.SelectedRow.Cells("CompanyName").Value
        MaterialInwardBindingSource.Current("FromAddress1") = ucboFromCompanyName.SelectedRow.Cells("Address1").Value
        MaterialInwardBindingSource.Current("FromAddress2") = ucboFromCompanyName.SelectedRow.Cells("Address2").Value
        MaterialInwardBindingSource.Current("FromAddress3") = ucboFromCompanyName.SelectedRow.Cells("Address3").Value
        MaterialInwardBindingSource.Current("FromPostalCode") = ucboFromCompanyName.SelectedRow.Cells("PostalCode").Value
        MaterialInwardBindingSource.Current("FromCity") = ucboFromCompanyName.SelectedRow.Cells("City").Value
        MaterialInwardBindingSource.Current("FromRegion") = ucboFromCompanyName.SelectedRow.Cells("Region").Value
        MaterialInwardBindingSource.Current("FromCountryName") = ucboFromCompanyName.SelectedRow.Cells("CountryName").Value
    End Sub

Open in new window

0
Comment
Question by:prinsbj
  • 2
3 Comments
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 500 total points
Comment Utility
This is one of these things that happens behind your back when you use DataBinding.

Call the AcceptChanges method on the DataRow. It will reset the RowState to Unchanged.
0
 

Author Comment

by:prinsbj
Comment Utility
How can I do that?
0
 

Author Comment

by:prinsbj
Comment Utility
I've found it. Thank you!
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now