I am new to Visual Basic and have learned mainly from Trial and Error. I definitely don't do things the way they are supposed (at least that is what I think.) Here is my problem. I have a windows form that displays a datagrid of employees. When the user double clicks on an employee it opens another form where the data can be modified. The way I accomplish this is to have a check for an employee id on the form that gets set from the first form (employeeid). Using the employeeid, I use the following code to load the record onto the form (see EmployeeLoad Event code). Now what I want to do is to see if any changes have been made to the record before allowing the form to be closed (see CancelAddButton_Click code).
I never get the Prompt to Save data message. When debugging, EmployeeDrow.RowState always says Unchanged. What am I doing wrong?
If pfmsDataSet1.Employees.Count = 1 Then
EmployeeDrow = pfmsDataSet1.Employees.Rows(0) ' EmployeeDrow is a global variable
MsgBox("More than 1 employee found")
If EmployeeDrow.RowState = DataRowState.Modified Then
MsgBox("Prompt to save data")