DataGridView refresh problem


Author
Message
Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
I have a Refresh or Display problem with a DataGridView control. The control is in a ChildForm, and the first time I open the child form "MyChildFormDialog.ShowDialog()" will show all the records in the datagridview, but if I cancel this childform, and open it again, the datagridview will have all records but only the first one will be displayed, if I scroll down then the rest of the rows will be shown.



Please see the attached video to better understanding of the problem.



Here is the call to Show the childform:





Private Sub cmdAddCards_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdAddCards.Click

Me.BizTransactionItems1.SaveCurrentDataTableToSnapshot("CardToBeActivated")

If Me.ChildFormDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then

Me.ListView1.Requery()

Else

Me.BizTransactionItems1.RestoreCurrentDataTableSnapshot("CardToBeActivated", True)

End If

End Sub





Here is the code to populate the datagridview:





Private Sub GetAvailableInactiveCards()

'-- Get the available Inactive Cards

If Me.BizTransaction1.Count > 0 Then

Me.BizTransactionItemsStock1.FillByActiveCarrier_ITemType_And_Item(Me.BizTransaction1.FK_Vendor_Carrier, Me.cboCardName.SelectedValue)

End If



Me.DataGridView1.Refresh()



Me.ShowInactiveStockQtyValue()

Me.SetObjectStateForButtons()



Me.txtQty.Focus()

Me.txtQty.SelectAll()

End Sub





Here is the call to Cancel and close the child form:





Private Sub cmdCancelActivation_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdCancelActivation.Click

Me.BizTransactionItemsStock_To_Activate.Clear()

Me.BizTransactionItemsStock1.Clear()



DialogResult = Windows.Forms.DialogResult.Cancel

End Sub





All this is basic stuff, I have done this many times with a ListView without problems, but frankly working with a DataGridView is turning out to be a very unpleasant experience.



Any idea what may be happening here?

Edhy Rijo

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search