StrataFrame Forum

DataGridView behavior?

http://forum.strataframe.net/Topic23277.aspx

By Edhy Rijo - 6/1/2009

I am working with a DataGridView which is giving me a lot of headache BigGrin.



The end use needs to modify data in 2 consecutives columns of this DataGridView, and I am having the following issues:

1- When press Enter key, I want the cursor to move to the 2nd column (like when pressing the Tab key), but instead it is going to the next row.

2 - Still I am having problem with the BBS not synchronizing with the BBS BO, for now I had to add code to the DataGridView.RowEnter to handle this, but when I edit a cell, the value is not reflected in the BO.Field assigned to that cell, so in my validation code I have to assign the value of the cell to the BO.Field. Is this the way the DataGridView suppose to work?



I really appreciate some inside on this one since I am waisting a lot of time trying to make this DataGridView work. Unfortunately in this case I can not use a ListView because it would be very difficult to the end user to handle the data for the 2 columns that needs to be editable.w00t
By Trent L. Taylor - 6/1/2009

1- When press Enter key, I want the cursor to move to the 2nd column (like when pressing the Tab key), but instead it is going to the next row.




You will have to code this yourself. You will have to capture this keystroke and then programatically manage the behavior you want.



2 - Still I am having problem with the BBS not synchronizing with the BBS BO, for now I had to add code to the DataGridView.RowEnter to handle this, but when I edit a cell, the value is not reflected in the BO.Field assigned to that cell, so in my validation code I have to assign the value of the cell to the BO.Field. Is this the way the DataGridView suppose to work?




No. If this were the case, then it would really make binding pretty pointless. If you can figure out your indexing issue that we were not able to reproduce with the same sample you sent, then you can most likely get this resolved as well.



Also, you will want to be sure to update the bound contents on PropertyChanged versus on validation.
By Edhy Rijo - 6/1/2009

Trent L. Taylor (06/01/2009)
Also, you will want to be sure to update the bound contents on PropertyChanged versus on validation.




Humm, I can not find where to do this change, could you provide some hint?Wink
By Edhy Rijo - 6/1/2009

I tried this code in the form's New() but did not make any difference:



Public Sub New()

' This call is required by the Windows Form Designer.

InitializeComponent()





'-- Ensure that the home page is initially shown.

pmMain.SetActivePage(PageHome)



Me.DataGridView1.DataBindings.DefaultDataSourceUpdateMode = DataSourceUpdateMode.OnPropertyChanged

End Sub





Am I in the right path here?
By Trent L. Taylor - 6/2/2009

Yeah...that looks good.