Do I have to check RowState Detached

T

Tony Johansson

Hello!

I have a DataGridView that represent a DataTable with some DataRow.
I have also these bindings.
_bindingSource.DataSource = _dataTable;
dataGridViewWareHouse.DataSource = _bindingSource;

When clicking on the Save button I write to a textfile.

Now to my question when I Change,Add or delete rows in the DataGridView do I
ever
have to check the rowState Detached.

//Tony
 
C

Cor Ligthert[MVP]

Tony,

Is it possible that you stay in the same message, because today you have
made more related message.

Don't be afraid, this will be seen by others too, but then they know what
you are doing,

By the way, what we don't know yet is, are you rewriting the complete
textfile or only the changed rows?

Cor
 
T

Tony Johansson

Hello!

I will do one of these alternatives.
1. Add new rows to the Textfile which mean new products.
2. Change existing products for example change the number of items for a
particularly product.
3. Delete a product from the file.

//Tony
 
T

Tony Johansson

Hello!

When I delete a row from the DataGridView how can I get this row so I have a
change to remove
it from the textfile.
I use a DataGridView to represent the DataTable with its DataRows
In addition I use
_bindingSource.DataSource = _dataTable;
dataGridViewWareHouse.DataSource = _bindingSource;

//Tony
 
T

Tony Johansson

Hello

I saw I could use this DataRowVersion.Original on a DataRow like this
string prodNo = (string)row["ProdNr", DataRowVersion.Original].ToString();


//Tony
 
C

Cor Ligthert[MVP]

Tony,

I am very curious how you do that removing and adding of rows to your
textfile.

Cor

Tony Johansson said:
Hello

I saw I could use this DataRowVersion.Original on a DataRow like this
string prodNo = (string)row["ProdNr", DataRowVersion.Original].ToString();


//Tony
Tony Johansson said:
Hello!

When I delete a row from the DataGridView how can I get this row so I
have a change to remove
it from the textfile.
I use a DataGridView to represent the DataTable with its DataRows
In addition I use
_bindingSource.DataSource = _dataTable;
dataGridViewWareHouse.DataSource = _bindingSource;

//Tony
 
T

Tony Johansson

Hello!

So if I will add a new product I just use append to the textfile.
So if I will remove a product I create a temporary file on Path and then
looping and writing to tempfile
and when I find don't write and then I use suitable File.
So if I have to change I do similar thing with the textfile but I insted
write the changes back.

Hope you understand what I mean.


//Tony

Cor Ligthert said:
Tony,

I am very curious how you do that removing and adding of rows to your
textfile.

Cor

Tony Johansson said:
Hello

I saw I could use this DataRowVersion.Original on a DataRow like this
string prodNo = (string)row["ProdNr",
DataRowVersion.Original].ToString();


//Tony
Tony Johansson said:
Hello!

When I delete a row from the DataGridView how can I get this row so I
have a change to remove
it from the textfile.
I use a DataGridView to represent the DataTable with its DataRows
In addition I use
_bindingSource.DataSource = _dataTable;
dataGridViewWareHouse.DataSource = _bindingSource;

//Tony


"Cor Ligthert[MVP]" <[email protected]> skrev i meddelandet
Tony,

Then first try to find how you do that to a textfile.

Cor

Hello!

I will do one of these alternatives.
1. Add new rows to the Textfile which mean new products.
2. Change existing products for example change the number of items for
a particularly product.
3. Delete a product from the file.

//Tony


"Cor Ligthert[MVP]" <[email protected]> skrev i meddelandet
Tony,

Is it possible that you stay in the same message, because today you
have made more related message.

Don't be afraid, this will be seen by others too, but then they know
what you are doing,

By the way, what we don't know yet is, are you rewriting the complete
textfile or only the changed rows?

Cor

Hello!

I have a DataGridView that represent a DataTable with some DataRow.
I have also these bindings.
_bindingSource.DataSource = _dataTable;
dataGridViewWareHouse.DataSource = _bindingSource;

When clicking on the Save button I write to a textfile.

Now to my question when I Change,Add or delete rows in the
DataGridView do I ever
have to check the rowState Detached.

//Tony
 
C

Cor Ligthert[MVP]

Tony,

Then as I understand you well for the same, you can simply write a new file,
because that has the same effect.

(And don't forget then to create a temp file before you start writing the
new one)

In my idea will that go much quicker while it is easier to do.

Be aware that you cannot use both solutions with more then 1 user active at
a time.

Cor

Tony Johansson said:
Hello!

So if I will add a new product I just use append to the textfile.
So if I will remove a product I create a temporary file on Path and then
looping and writing to tempfile
and when I find don't write and then I use suitable File.
So if I have to change I do similar thing with the textfile but I insted
write the changes back.

Hope you understand what I mean.


//Tony

Cor Ligthert said:
Tony,

I am very curious how you do that removing and adding of rows to your
textfile.

Cor

Tony Johansson said:
Hello

I saw I could use this DataRowVersion.Original on a DataRow like this
string prodNo = (string)row["ProdNr",
DataRowVersion.Original].ToString();


//Tony
"Tony Johansson" <[email protected]> skrev i meddelandet
Hello!

When I delete a row from the DataGridView how can I get this row so I
have a change to remove
it from the textfile.
I use a DataGridView to represent the DataTable with its DataRows
In addition I use
_bindingSource.DataSource = _dataTable;
dataGridViewWareHouse.DataSource = _bindingSource;

//Tony


"Cor Ligthert[MVP]" <[email protected]> skrev i meddelandet
Tony,

Then first try to find how you do that to a textfile.

Cor

Hello!

I will do one of these alternatives.
1. Add new rows to the Textfile which mean new products.
2. Change existing products for example change the number of items
for a particularly product.
3. Delete a product from the file.

//Tony


"Cor Ligthert[MVP]" <[email protected]> skrev i meddelandet
Tony,

Is it possible that you stay in the same message, because today you
have made more related message.

Don't be afraid, this will be seen by others too, but then they know
what you are doing,

By the way, what we don't know yet is, are you rewriting the
complete textfile or only the changed rows?

Cor

Hello!

I have a DataGridView that represent a DataTable with some DataRow.
I have also these bindings.
_bindingSource.DataSource = _dataTable;
dataGridViewWareHouse.DataSource = _bindingSource;

When clicking on the Save button I write to a textfile.

Now to my question when I Change,Add or delete rows in the
DataGridView do I ever
have to check the rowState Detached.

//Tony
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top