By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,219 Members | 2,242 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,219 IT Pros & Developers. It's quick & easy.

DataGrid does not work correctly when selecting item to fill controls and refreshing...HELP???

P: n/a
I have been having just on going problems with my MS Datagrids. I have NO
idea what I am doing wrong.

What is esentially happening is that say I have three records in my Dataset.
I click on the third row to populate the textboxes below the grid that
correspond to the various columns in the grid. The textboxes fill. I edit
the data in one of the textboxes. As I lose focus I update the dataset and
refresh the grid.

Well the third row refreshes just fine. But I also fine that the first row
in my dataset also gets updates WITH ALL OF THE DATA FROM THE THIRD ROW??? I
have traced the dataset all through the update and cannot for the life of me
see where this happens. It seems to happen behind the scenes somewhere
through the databinding.

Anyway it is driving me nuts. Any ideas.
Nov 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi,

Post your code.

Ken
---------------------
"Aaron Ackerman" <no@spam.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
I have been having just on going problems with my MS Datagrids. I have NO
idea what I am doing wrong.

What is esentially happening is that say I have three records in my
Dataset.
I click on the third row to populate the textboxes below the grid that
correspond to the various columns in the grid. The textboxes fill. I edit
the data in one of the textboxes. As I lose focus I update the dataset and
refresh the grid.

Well the third row refreshes just fine. But I also fine that the first row
in my dataset also gets updates WITH ALL OF THE DATA FROM THE THIRD ROW???
I
have traced the dataset all through the update and cannot for the life of
me
see where this happens. It seems to happen behind the scenes somewhere
through the databinding.

Anyway it is driving me nuts. Any ideas.

Nov 20 '05 #2

P: n/a
Private Sub txtConLastName_LostFocus(ByVal sender As Object, ByVal e As
System.EventArgs) Handles txtConLastName.LostFocus

Try ' Set up structured error handling.
vdsClientUI.ContactByID.Rows(dgContacts.CurrentRow Index).Item("PersonLastNam
e") = Me.txtConLastName.Text
objClient.UpdateContactByID(Me.vdsClientUI, "ContactByID")
RefreshContactsGrid()
Catch ex As Exception ' Catch the error.
Me.blnErrorLogged = ErrorLog(ex.ToString) 'Log Error in DB
MsgBox(ex.ToString) 'Show friendly error message.
Me.Close() 'Close Form
Finally
' Beep after error processing.
End Try
End Sub
Private Sub RefreshContactsGrid()
Try ' Set up structured error handling.
Me.dgContacts.DataBindings.Clear()
vdsClientUI.Tables("ContactSelectAll").Clear()
vdsClientUI.Tables("ContactSelectAll").Dispose()

vdsClientUI.Tables("ContactByID").Clear()
vdsClientUI.Tables("ContactByID").Dispose()
'Me.dgContacts.Refresh()
vdsClientUI = objClient.selContacts(intClientID,
Me.strEmploymentConsultantSSN)
Me.dgContacts.SetDataBinding(vdsClientUI, "ContactSelectAll")
Me.dgContacts.DataBindings.Clear()

vdsClientUI = objClient.selContactByID(intClientID,
Me.strEmploymentConsultantSSN)
Catch ex As Exception ' Catch the error.
Me.blnErrorLogged = ErrorLog(ex.ToString) 'Log Error in DB
MsgBox(ex.ToString) 'Show friendly error message.
Me.Close() 'Close Form
'Application.ExitThread() 'Exit App
Finally
' Beep after error processing.
End Try

End Sub
"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:eQ**************@TK2MSFTNGP11.phx.gbl...
Hi,

Post your code.

Ken
---------------------
"Aaron Ackerman" <no@spam.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
I have been having just on going problems with my MS Datagrids. I have NO
idea what I am doing wrong.

What is esentially happening is that say I have three records in my
Dataset.
I click on the third row to populate the textboxes below the grid that
correspond to the various columns in the grid. The textboxes fill. I edit the data in one of the textboxes. As I lose focus I update the dataset and refresh the grid.

Well the third row refreshes just fine. But I also fine that the first row in my dataset also gets updates WITH ALL OF THE DATA FROM THE THIRD ROW??? I
have traced the dataset all through the update and cannot for the life of me
see where this happens. It seems to happen behind the scenes somewhere
through the databinding.

Anyway it is driving me nuts. Any ideas.


Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.