?
Solved

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

Posted on 2011-09-27
3
Medium Priority
?
315 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 2000 total points
ID: 36712962
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
ID: 36712967
How can I do that?
0
 

Author Comment

by:prinsbj
ID: 36712999
I've found it. Thank you!
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Suggested Courses

864 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