ADDNEW won't move to new record

BLUNT

Newcomer
Joined
Jun 26, 2003
Messages
4
Location
Vermont
I have built a form that is bound to a dataset. The form is not showing a grid.

I have built this manualy and with the VS.Net wizzards with the same results.

When I click on the Add button and it runs the code:

me.bindingcontext(dataset,"Table Name").Addnew

The new record is added to the dataset, the count of the data set increases, but I can not navigate to the new record.

This was working and then it stopped which means I changed something and I can't figure out what I changed.

Any and all help is appreciated.

BLUNT
 
You add a new row to the dataset as in the example below.

Visual Basic:
        Dim NewRow As DataRow = dataset2.Tables("employees").NewRow
        NewRow("Name") = cmbEmployeeName.Text
        NewRow("Phone") = "Enter Employee Phone"
        NewRow("BeginningPTO") = 0
        NewRow("DateHired") = Date.Now
        
        dataset2.Tables("Employees").Rows.Add(NewRow)


Jon
 
Add New Fail

Interesting debug process that lead me to getting it to work but still stumped.

1) The issue was with a CheckBox field linked to a Boolean field. In a data for (non-grid), it would add the record but not let you navigate to it. In a data-grid all worked well.

2) If I changed the field from a checkbox to a list box with True/False as the choices, the AddNew worked like a charm.

I ran into this same issue later on in a Data Grid with a CheckBox field liked to a Boolean. The compile would work fine, but the execution would give an exectption error indicating that the data (Boolean) was not compatible with a CheckBox field!

Any ideas on the cause of this is appreciated.
 
thanks so much for posting that article. You just saved me about $100 worth of spackle for holes I was about to put in the drywall.
 
Back
Top