Solved

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

Posted on 2011-09-27
3
305 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 500 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
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
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 UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

695 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