Click here to Skip to main content
15,851,701 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all. I have a DataGridView. Each time I click the grid the items of the grid will be delivered to TextBoxes and a PictureBox (since the grid has an image item). What I'm confusing of is I have to delay clicking the items in the grid for about 10 seconds. If I click it without delaying it causes error. And if I click it every 15 seconds, for example, it runs normally. The grid populates data from an access database. How to solve it? Thank you in advance.
Here is the code

Private Sub DataGridView1_CellClick(sender As Object, e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellClick

        Dim i As Integer = DataGridView1.CurrentRow.Index

        Me.lblGridName.Text = DataGridView1.Item(0,i).Value
        Me.lblGridAge.Text = DataGridView1.Item(1,i).Value

        Dim gb() As Byte = CType(DataGridView1.Item(2,i).Value, Byte())
        Dim stm As New MemoryStream(gb)
        Me.PictureBox1.Image = Image.FromStream(stm)

End Sub

1 solution

I have thought of a way you may be able to delay clicking for 10 seconds but it isn't a very good way of going about it.

What you could do is add a timer, start the timer once the user clicks on a dataview grid, and disable the grid. Once the timer has finished (set it to 10 seconds - 1000) enable the grid again.

I don't really know much about Dataview grids so this may not work, and using timers to solve this issue is not the best solution in the world but if this does work it can be used for the time being until a better solution is suggested.

Hope I have been of some help.
Good Luck :-)
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900