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

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Edhy....there is no way for me to give you a straigh answer without having something that reproduces this. I would really love to tell you to "flip this switch" but there are too many things in the mix at this point. It is possible for you to reproduce this somehow?
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
Thanks Trent.



Frustration levels are getting to the top on my side with the DataGridView control, all these problems are really holding me up in moving forward with this project. I'll try to duplicate this in the Business Binding Source Sample project.



Did you look at the video I uploaded in my previous post? This refresh thing is very strange.

Edhy Rijo

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Yeah...this is one reason I am not much of a grid fan....they are not always THIS irritating...but at some point they always make me want to cuss!
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
Trent L. Taylor (06/03/2009)
...but at some point they always make me want to cuss!


Well, I don't usually give up on these sort of things, but due to the highly pressure of this project and all the time wasted trying to get the datagridview to work, I took a deep breath and review my approach and there it was the answer to my prayers Smile "use a listview with a childform dialog", even though I believe a grid would have done more sense for the end user, the simplicity of using a listview and a childform dialog provides much more control on how to handle the data validations.



I will retake the datagridview issue when I have more time to spend, and probably at that time, MS may have a new, better version of this control.Hehe

Edhy Rijo

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
LOL...I have been there before my friend! BigGrin
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search