DataView.AddNew and DataView.Count

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Im trying to determine if the last row in the bound Datagrid is selected so that i can add a new row to the datatable. the datagrid alternates display of different datatables so the # rows is not fixed. I cant check if the current row = DataView.Count because DataView.Count changes when you click the last row so there are 2 cases wher this is true(the last and the second to last
what am i missing
thanks
 
Subt:

Is this a winforms grid? If so, the user can just arrow down and the new
row will be added. Also, can you tell me a bit more about the alternating
binding?
subt said:
Im trying to determine if the last row in the bound Datagrid is selected
so that i can add a new row to the datatable. the datagrid alternates
display of different datatables so the # rows is not fixed. I cant check if
the current row = DataView.Count because DataView.Count changes when you
click the last row so there are 2 cases wher this is true(the last and the
second to last)
 
Subt:

Also, can you just walk through the DataView? The last example in my
article here http://www.knowdotnet.com/articles/dataviews1.html shows you
how to walk through a DataView. As such, when the enumerator goes false,
you know the index of the last row, you can compare this to the currentCell
and test for a match.
subt said:
Im trying to determine if the last row in the bound Datagrid is selected
so that i can add a new row to the datatable. the datagrid alternates
display of different datatables so the # rows is not fixed. I cant check if
the current row = DataView.Count because DataView.Count changes when you
click the last row so there are 2 cases wher this is true(the last and the
second to last)
 
what i mean is the displayed data in the DataGrid is 1 of several possible tablestyles(and also different datatables) depending on other selections on the form. If i simply add data to the new row at the end, it wont register in the dataset because some non- nullable columns are hidden from the user. So I need to know when the user hits that last row so that i can choose and register appropriate columnid data for that particular table and row

or am i making it too complicated
 
Subt:

If you added DefaultValue's for the non nullable columns, that should fix
that problem. If they need edited, you can hit the underlying table
directly. Did you catch my other post about the DataView? If so, will that
work for you?
subt said:
what i mean is the displayed data in the DataGrid is 1 of several possible
tablestyles(and also different datatables) depending on other selections on
the form. If i simply add data to the new row at the end, it wont register
in the dataset because some non- nullable columns are hidden from the user.
So I need to know when the user hits that last row so that i can choose and
register appropriate columnid data for that particular table and row.
 
yes thanks, your info and article helped to sort some things out

i think i have things working they way i want..
 
Back
Top