|
-
May 27th, 2008, 12:02 PM
#1
Thread Starter
Addicted Member
[2005] Refresh Datagridview?
Hi all,
I am currently having a problem getting my datagridview to update after I have edited a record.
First off, I edit the record on a seperate form. I then pass those values (id and nbr) back to a function on the main form, and that function in turn calls an SQL query to get the updated record.
Code:
Public Function RefreshTable(ByRef id As String, ByRef nbr As String) As Boolean
Dim coll As New User
Dim i As Integer
Try
'get the most recent record(s)
DataMgr.GetRec(necessary parameters here)
Catch ex As Exception
If MessageBox.Show("No records found for the id/nbr combination entered", "Application Error", MessageBoxButtons.OK) _
= Windows.Forms.DialogResult.OK Then
Me.Focus()
End If
End Try
'clear the datagrid
DataGridView1.Rows.Clear()
'set the size of the grid
DataGridView1.Width = 643
DataGridView1.Height = 160
'fill the datagrid with the collection data
For i = 0 To coll.Count - 1
DataGridView1.Rows.Add(coll(i).id, coll(i).nbr).ToString()
Next
End Function
The issue is that the datagridview does not change. It displays the same record(s) and does not show me the updated version of the record I just changed.
I'm scratching my head because the collection, at this point, contains the most updated record from the database, but I simply cannot get the record to display on the grid. I'm sure it's something easy that I'm missing (as usual), but I have no idea what it is.
If my post helped you, please rate it!
Languages: VB/ASP.NET 2005, C# 2008,VB6
Databases: Oracle (knowledge not currently in use), DB2
FROM Customers
WHERE We_Know_What_We_Want <> DB.Null
SELECT *
0 rows returned
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|