473,383 Members | 1,789 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

How to supress deleting a Row

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
9 1699
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
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
Hamed,

I'm in now way an expert, but could you use the Hittest to find the row the
user is trying to delete, and check within that row for the occurance of the
piece of data that specifies when you don't want to allow deletion? You could
then simply disallow this deletion.

I suppose this solution is determined by how complicated your rules are for
allowing / not allowing rows to be deleted.

Perhaps a bit more information on what determines whether your rows can /
can't be deleted may help someone find you solution?

James.

"Hamed" wrote:
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 #4
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 #5
James

The case is not strange. It is simply a Grid of rows in a database
application. the rule is if any row is referred (or used) in another table,
it cannot be deleted using the Del key in the Grid. If I can somehow
prohibit delete of a specified row, I simply do the job for the rows in the
bound DataTable.

Regards
Hamed
P.S. As far as I know, Hittest checks physical position of a point in the
Grid rectangle, If I am wrong please correct me. If I am right, then this is
not my case. I want to disallow deletion of a certain row in a DataView or a
DataTable that is bound to a Grid and may have a lot of records so the Grid
scrolls. How does Hittest help in such a case?
"James Vickers" <Ja**********@discussions.microsoft.comwrote in message
news:5D**********************************@microsof t.com...
Hamed,

I'm in now way an expert, but could you use the Hittest to find the row
the
user is trying to delete, and check within that row for the occurance of
the
piece of data that specifies when you don't want to allow deletion? You
could
then simply disallow this deletion.

I suppose this solution is determined by how complicated your rules are
for
allowing / not allowing rows to be deleted.

Perhaps a bit more information on what determines whether your rows can /
can't be deleted may help someone find you solution?

James.

"Hamed" wrote:
>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 #6
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 #7
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 #8
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 #9
Hamed,

Yes it checks a psyhical position, but at the same time that "could" have
been used. I assumed that you were indicating a user would have to select a
row to delete, therefore, if they had to select it, you would know which it
was! The Hittest would have then allowed you to indicate the row (and
therefore every cell referenced by that row) that was due to be deleted.

As I said, not knowing your rules, if it were (say for example) any row that
did not contain the number 3, in cell 4 (rough example!) you could have
checked in cell 4, for the value, and if were not 3, allow deletion,
otherwise, not allow it!

Maybe in the .NET days a complicated way of doing things, but i'm from the
days of VB6, and work arounds were part of the fun back then.

As I said in my original post, i'm not an expert, but just someone trying to
help.

James.

"Hamed" wrote:
James

The case is not strange. It is simply a Grid of rows in a database
application. the rule is if any row is referred (or used) in another table,
it cannot be deleted using the Del key in the Grid. If I can somehow
prohibit delete of a specified row, I simply do the job for the rows in the
bound DataTable.

Regards
Hamed
P.S. As far as I know, Hittest checks physical position of a point in the
Grid rectangle, If I am wrong please correct me. If I am right, then this is
not my case. I want to disallow deletion of a certain row in a DataView or a
DataTable that is bound to a Grid and may have a lot of records so the Grid
scrolls. How does Hittest help in such a case?
"James Vickers" <Ja**********@discussions.microsoft.comwrote in message
news:5D**********************************@microsof t.com...
Hamed,

I'm in now way an expert, but could you use the Hittest to find the row
the
user is trying to delete, and check within that row for the occurance of
the
piece of data that specifies when you don't want to allow deletion? You
could
then simply disallow this deletion.

I suppose this solution is determined by how complicated your rules are
for
allowing / not allowing rows to be deleted.

Perhaps a bit more information on what determines whether your rows can /
can't be deleted may help someone find you solution?

James.

"Hamed" wrote:
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 15 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: LRW | last post by:
I'm creating a simple reply form, and if a form item isn't answered I get an error: "Notice: Undefined index: rb_amntspent in c:\inetpub\wwwroot\mackinaw\survey.php on line 36" even if in the...
1
by: roderik | last post by:
How do I supress the output generated from each psycopg command: >>> import psycopg initpsycopg: initializing psycopg 1.99.10 typecast_init: initializing NUMBER .. .. microprotocols_add:...
1
by: David | last post by:
I have a custom control that contains a class that Inherits the panel control. I am trying to catch a keydown event in this class and then supress it from the rest of the control as well as the...
3
by: JG | last post by:
Hi all, I have a simple aspx page. On the page there is only one button. When I click on the button, the event sequence is Page_Load, Button1_click and Page_PreRender. How do I supress the...
2
by: Still Learning | last post by:
Hi, Currently a crystal report is getting 359.9999 from a dataset. Even with rounding set to 0.0001 it displays 360.0 which is wrong. How can I supress rounding or get it to display 359.9999? ...
4
by: rob c | last post by:
This is a minor thing and only appears in IE (so far), but I'd like to know to correct it (if possible). Whenever I use a form on a webpage, Explorer always leaves a blank line following the...
6
by: Hamed | last post by:
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...
1
by: Nikhil Mittal | last post by:
How to supress system errors in windows perl In unix it is 2>&1 , what is in windows :o
2
by: khani | last post by:
Hi i have following situation in cystal report in detail section i have a field say name.now i have five duplication record like this zahid zahid zahid zahid
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.