From: Rob W on 17 Mar 2010 15:25 Greetings, I have a connectmenustrip item that when clicked runs the following code (see below) Now if the event is called by the button i.e. cmdDeleteingBooking.Click the linq query returns the appropriate value. However when called by cntMnuCancelBookingItem.Click is returns 0 even if a checkbox is of 'TRUE' value. Debugging shows the code runs exactly the same code (which loops around rows in a datagridview checking if the checkbox has been checked). Could someone explain the reasoning why the same code would return different results? Private Sub cmdDeleteingBooking_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdDeleteingBooking.Click, cntMnuCancelBookingItem.Click MessageBox.Show("In here") 'Linq statement to count number of rows where Dim bookingsSelectedDeletion As Integer = (From bookings In dgvBookings.Rows _ Select bookings _ Where CType(DirectCast(bookings, DataGridViewRow).Cells("selectColumn").FormattedValue, Boolean) = True).Count MessageBox.Show("Number is " & bookingsSelectedDeletion.ToString) End sub Thanks Rob
|
Pages: 1 Prev: what happens when a digital certificate expires Next: Format method |