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

How to supress deleting a Row

P: n/a
Hello

I have a DataGrid that a is bound to a DataTable. Some of the rows in the
DataTable should not be deleted. How can I prohibit deleting of some
identified rows?

The problem could be specified in the following format too:

There is a DataView object that I want to prohibit deleting of some of its
DataRowView objects. that is: when drv.Delete() is called (drv is the
identified DataRowView) it doesn't delete the DataRowView object (suppress
that the Deleted tag is assigned to the RowState) . How can I do this job?
Regards
Hamed
Aug 14 '06 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Datagridview
AllowUserToDeleteRows {true or false}

Datagrid
set the allow delete of the dataview that is bound to it to false

dim dt as datatable
dim dv as dataview
dim dbg as datagrid

'Get the default view from the table
dv = dt.defaultview

'Disallow deleted
dv.allowdelete = false

'Set the datasource
dbg.datasource = dv

"Hamed" <ha***@raymehr.comwrote in message
news:eB**************@TK2MSFTNGP05.phx.gbl...
Hello

I have a DataGrid that a is bound to a DataTable. Some of the rows in the
DataTable should not be deleted. How can I prohibit deleting of some
identified rows?

The problem could be specified in the following format too:

There is a DataView object that I want to prohibit deleting of some of its
DataRowView objects. that is: when drv.Delete() is called (drv is the
identified DataRowView) it doesn't delete the DataRowView object (suppress
that the Deleted tag is assigned to the RowState) . How can I do this job?
Regards
Hamed

Aug 14 '06 #2

P: n/a
This technique disallows delete of whole grid. I want to prohibit delete of
some identified rows. for example I know that I should disallow deletion of
second row but others may be deleted.

Any help or comment is appreciated.

Hamed

"AMDRIT" <am****@hotmail.comwrote in message
news:er****************@TK2MSFTNGP04.phx.gbl...
Datagridview
AllowUserToDeleteRows {true or false}

Datagrid
set the allow delete of the dataview that is bound to it to false

dim dt as datatable
dim dv as dataview
dim dbg as datagrid

'Get the default view from the table
dv = dt.defaultview

'Disallow deleted
dv.allowdelete = false

'Set the datasource
dbg.datasource = dv

"Hamed" <ha***@raymehr.comwrote in message
news:eB**************@TK2MSFTNGP05.phx.gbl...
>Hello

I have a DataGrid that a is bound to a DataTable. Some of the rows in the
DataTable should not be deleted. How can I prohibit deleting of some
identified rows?

The problem could be specified in the following format too:

There is a DataView object that I want to prohibit deleting of some of
its DataRowView objects. that is: when drv.Delete() is called (drv is the
identified DataRowView) it doesn't delete the DataRowView object
(suppress that the Deleted tag is assigned to the RowState) . How can I
do this job?
Regards
Hamed


Aug 14 '06 #3

P: n/a
Hamid,

The check which row it is do you have to do of course yourself, but that
should be for every developer a piece of cake.

http://www.vb-tips.com/dbpages.aspx?...9-57ec163eaa17

I hope this helps,

Cor

"Hamed" <ha***@raymehr.comschreef in bericht
news:eB**************@TK2MSFTNGP05.phx.gbl...
Hello

I have a DataGrid that a is bound to a DataTable. Some of the rows in the
DataTable should not be deleted. How can I prohibit deleting of some
identified rows?

The problem could be specified in the following format too:

There is a DataView object that I want to prohibit deleting of some of its
DataRowView objects. that is: when drv.Delete() is called (drv is the
identified DataRowView) it doesn't delete the DataRowView object (suppress
that the Deleted tag is assigned to the RowState) . How can I do this job?
Regards
Hamed

Aug 14 '06 #4

P: n/a
Thanks Cor. I checked it. It seems it can solve my problem.

Regards
Hamed
"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:e3******************@TK2MSFTNGP04.phx.gbl...
Hamid,

The check which row it is do you have to do of course yourself, but that
should be for every developer a piece of cake.

http://www.vb-tips.com/dbpages.aspx?...9-57ec163eaa17

I hope this helps,

Cor

"Hamed" <ha***@raymehr.comschreef in bericht
news:eB**************@TK2MSFTNGP05.phx.gbl...
>Hello

I have a DataGrid that a is bound to a DataTable. Some of the rows in the
DataTable should not be deleted. How can I prohibit deleting of some
identified rows?

The problem could be specified in the following format too:

There is a DataView object that I want to prohibit deleting of some of
its DataRowView objects. that is: when drv.Delete() is called (drv is the
identified DataRowView) it doesn't delete the DataRowView object
(suppress that the Deleted tag is assigned to the RowState) . How can I
do this job?
Regards
Hamed


Aug 15 '06 #5

P: n/a
Thanks Cor. I checked it. It seems it can solve my problem.

Regards
Hamed
"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:e3******************@TK2MSFTNGP04.phx.gbl...
Hamid,

The check which row it is do you have to do of course yourself, but that
should be for every developer a piece of cake.

http://www.vb-tips.com/dbpages.aspx?...9-57ec163eaa17

I hope this helps,

Cor

"Hamed" <ha***@raymehr.comschreef in bericht
news:eB**************@TK2MSFTNGP05.phx.gbl...
>Hello

I have a DataGrid that a is bound to a DataTable. Some of the rows in the
DataTable should not be deleted. How can I prohibit deleting of some
identified rows?

The problem could be specified in the following format too:

There is a DataView object that I want to prohibit deleting of some of
its DataRowView objects. that is: when drv.Delete() is called (drv is the
identified DataRowView) it doesn't delete the DataRowView object
(suppress that the Deleted tag is assigned to the RowState) . How can I
do this job?
Regards
Hamed


Aug 15 '06 #6

P: n/a
Thanks Cor. I am going to check it.

It seems it can solve my problem.

Regards
Hamed
"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:e3******************@TK2MSFTNGP04.phx.gbl...
Hamid,

The check which row it is do you have to do of course yourself, but that
should be for every developer a piece of cake.

http://www.vb-tips.com/dbpages.aspx?...9-57ec163eaa17

I hope this helps,

Cor

"Hamed" <ha***@raymehr.comschreef in bericht
news:eB**************@TK2MSFTNGP05.phx.gbl...
>Hello

I have a DataGrid that a is bound to a DataTable. Some of the rows in the
DataTable should not be deleted. How can I prohibit deleting of some
identified rows?

The problem could be specified in the following format too:

There is a DataView object that I want to prohibit deleting of some of
its DataRowView objects. that is: when drv.Delete() is called (drv is the
identified DataRowView) it doesn't delete the DataRowView object
(suppress that the Deleted tag is assigned to the RowState) . How can I
do this job?
Regards
Hamed



Aug 15 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.