We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

New Row

Thread ID:





3312 Mar 12,2003 10:33 AM UTC Mar 14,2003 10:09 AM UTC WinForms 1
Tags: FAQ
Administrator [Syncfusion]
Asked On March 12, 2003 10:33 AM UTC

When datagrid add a new row, what is the event that is launched? I should add programically data to some cells on a new row after it's created.

Administrator [Syncfusion]
Replied On March 14, 2003 10:09 AM UTC

Hi. I have had the same problem when the new row needs a foreign key value and I have to set it programically. I use to add a handler like this Private Sub InitializeClassRoomBookingsGrid() AddHandler dsClassRoomBookings.tblClassRoomBookings.RowChanged, AddressOf HandleClassRoomBookingTableRowChanged ... ... End Sub And write the function it calls (HandleClassRoomBookingTableRowChanged) ' Purpose: Solves the problem with foreign keys when adding a new row to the ' dsClassRoomBookings.tblClassRoomBookings datatable. ' Input: sender = dsClassRoomBookings.tblClassRoomBookings datatable. ' e = DataRowChangeEventArgs ' Output: Setting the fields CRB_CRID to the same values as in the ClassRoomsListBox Sub HandleClassRoomBookingTableRowChanged(ByVal sender As Object, ByVal e As System.Data.DataRowChangeEventArgs) If e.Row("CRB_CRID") Is DBNull.Value Then e.Row("CRB_CRID") = dsClassRooms.ClassRooms.Rows(ClassRoomsListBox.SelectedIndex)("CR_ID") End If End Sub One problem you can bump into is that the Foreign key field doesnt allow Null values. I solved it by using a strongly typed dataset and then you can change property for the field to allow Null values. If this is your case and you dont understand the last part then reply on the message.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon