Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

  • *Experts*
Posted

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

 

       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

  • 2 weeks later...
Posted

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.

  • 4 months later...
  • 10 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...