NEED BADLY to remove (programmatically) a row from a DataGrid without deleting it from the DataBase

  • Thread starter Thread starter Jordan Kaufman
  • Start date Start date
J

Jordan Kaufman

Hi,

I need to remove a row from a DataGrid without effecting the Database. I've
seen this question posted on the all over but never answered.

(f it helps I use the datagrid to export an excel file, but need to preen
down the grid based on an algorith that can not be put into my SQL Query.)

PLEASE HELP!
 
Jordan said:
Hi,

I need to remove a row from a DataGrid without effecting the Database. I've
seen this question posted on the all over but never answered.

(f it helps I use the datagrid to export an excel file, but need to preen
down the grid based on an algorith that can not be put into my SQL Query.)

PLEASE HELP!
Can you use a dataview filtered to exclude that row? Then export based
on the records in the view.

T
 
Hello,

This is what I do to clear the rows in a datagrid view when populating
the grid with new data. (The datagrid view is not bound to any data
source, input comes from users):

--------------------------------------------------------------------------------------------------------------------------

Private Sub InitalizeDataGridView()

.... some code ...

If DATAGRIDVIEW.RowCount > 0 Then
DATAGRIDVIEW.Rows(0).DataGridView.Rows.Clear()

.... some code ...

End Sub

--------------------------------------------------------------------------------------------------------------------------

The IF statement stops the initial out-of-bounds error during the first
run of the program.
From then on, Initial Rows in the datagrid are populated with default
valules for user input. When new default data is needed, the Initialize
routine is re-run causing the above statement to evaluate to 'True'
which then clears all the rows in the datagrid..

Can't explain why the code works, as I had spent much time searching
for an anwser to this issue myself and happened upon this solution
through the "Bang-head-on-keyboard" method...


- J
 
Back
Top