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

How to capture the delete row event handler in the datagrid?

P: n/a

Hello,

I have one basic simple question. When I have multiple records in the
datagrid as follows:

Code Product 1 Product 2 Product 3
11111 A B C
22222 D E F
33333 G H I
44444 J K L
I want when the user select the third row which holds the following
value: 33333, G, H, and I and presses the Delete key in the keyboard a
prompt message pops up saying: Are you sure you wish to delete record #
3333? If the user selects YES then it deletes that row. I know how to
do the rest what I don't know how to do is catch and trap the delete
key when that row is select to prompt that message. Can anyone help me
please? Thanks in advance.

Jan 11 '07 #1
Share this Question
Share on Google+
10 Replies


P: n/a
Hello am******@gmail.com,

http://www.syncfusion.com/FAQ/aspnet/WEB_c4c.aspx#q589q
http://www.syncfusion.com/FAQ/aspnet/WEB_c4c.aspx#q587q
---
WBR,
Michael Nemtsev [C# MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo
Hello,

I have one basic simple question. When I have multiple records in the
datagrid as follows:

Code Product 1 Product 2 Product 3
11111 A B C
22222 D E F
33333 G H I
44444 J K L
I want when the user select the third row which holds the following
value: 33333, G, H, and I and presses the Delete key in the keyboard a
prompt message pops up saying: Are you sure you wish to delete record
# 3333? If the user selects YES then it deletes that row. I know how
to do the rest what I don't know how to do is catch and trap the
delete key when that row is select to prompt that message. Can anyone
help me please? Thanks in advance.

Jan 11 '07 #2

P: n/a
I am sorry they did not help me at all. According to these two tips I
am suppose to make make my very own subroutine that have the delete
code in it then make a button where it will delete the rows...what I
want is a handler to fire when I highlight a single row and push the
delete button in the keyboard. I know how to do the other one easily
however I don't know how to do this...here is why I need it. We have a
shipping program that sometimes have a complete row with null value,
this causes this program to halt with an error of a null value, we
naturally want to delete that row and upload the inventory in the
server, however in order to do that we must first click the button save
before we upload that. We want to skip that process in such away that
when we delete that row (null values) it automatically saves it so that
we just click one button which is called upload instead of SAVE button
THEN Upload button. How to catch an event handler when the user
highlights that row and pushes the delete button? I have been in that
website and they failed miserably in assisting me in my problem. Can
anyone here help me please? Thanks in advance.

On Jan 11, 11:20 am, Michael Nemtsev <nemt...@msn.comwrote:
Hello amiga...@gmail.com,

http://www.syncfusion.com/FAQ/aspnet...c4c.aspx#q587q

---
WBR,
Michael Nemtsev [C# MVP] :: blog:http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo
Hello,
I have one basic simple question. When I have multiple records in the
datagrid as follows:
Code Product 1 Product 2 Product 3
11111 A B C
22222 D E F
33333 G H I
44444 J K L
I want when the user select the third row which holds the following
value: 33333, G, H, and I and presses the Delete key in the keyboard a
prompt message pops up saying: Are you sure you wish to delete record
# 3333? If the user selects YES then it deletes that row. I know how
to do the rest what I don't know how to do is catch and trap the
delete key when that row is select to prompt that message. Can anyone
help me please? Thanks in advance.
Jan 11 '07 #3

P: n/a
Thank you for the help but I solved the problem, for people out there
who have failed or stuck in the same predicament this is the answer:

Private Sub DATAGRIDNAMEHERE_PreviewKeyDown(ByVal sender As Object,
ByVal e As System.Windows.Forms.PreviewKeyDownEventArgs) Handles
dgRATemp.PreviewKeyDown
If e.KeyCode = Keys.Delete Then
.....
End If
End Sub

Jan 11 '07 #4

P: n/a

Right but now I am in a different delima..my boss wants the event to
occure AFTER the row is deleted not before the row is deleted. For
example

Row1: contains value X

When highlight Row1: that contains value X and I press the delete key
and the row is deleted THEN he wants the save to change not save the
change before the value is deleted. How do I do that?
On Jan 11, 11:29 am, amiga...@gmail.com wrote:
I am sorry they did not help me at all. According to these two tips I
am suppose to make make my very own subroutine that have the delete
code in it then make a button where it will delete the rows...what I
want is a handler to fire when I highlight a single row and push the
delete button in the keyboard. I know how to do the other one easily
however I don't know how to do this...here is why I need it. We have a
shipping program that sometimes have a complete row with null value,
this causes this program to halt with an error of a null value, we
naturally want to delete that row and upload the inventory in the
server, however in order to do that we must first click the button save
before we upload that. We want to skip that process in such away that
when we delete that row (null values) it automatically saves it so that
we just click one button which is called upload instead of SAVE button
THEN Upload button. How to catch an event handler when the user
highlights that row and pushes the delete button? I have been in that
website and they failed miserably in assisting me in my problem. Can
anyone here help me please? Thanks in advance.

On Jan 11, 11:20 am, Michael Nemtsev <nemt...@msn.comwrote:
Hello amiga...@gmail.com,
http://www.syncfusion.com/FAQ/aspnet...http://www.syn...
---
WBR,
Michael Nemtsev [C# MVP] :: blog:http://spaces.live.com/laflour
"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo
Hello,
I have one basic simple question. When I have multiple records in the
datagrid as follows:
Code Product 1 Product 2 Product 3
11111 A B C
22222 D E F
33333 G H I
44444 J K L
I want when the user select the third row which holds the following
value: 33333, G, H, and I and presses the Delete key in the keyboard a
prompt message pops up saying: Are you sure you wish to delete record
# 3333? If the user selects YES then it deletes that row. I know how
to do the rest what I don't know how to do is catch and trap the
delete key when that row is select to prompt that message. Can anyone
help me please? Thanks in advance.
Jan 11 '07 #5

P: n/a
Hello am******@gmail.com,

Sorry for the wrong info relating to my post - missed your point :)

About post-delete action. Why not to perform your custom tast on DataTable.RowDeleted
event?

---
WBR,
Michael Nemtsev [C# MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo
Right but now I am in a different delima..my boss wants the event to
occure AFTER the row is deleted not before the row is deleted. For
example

Row1: contains value X

When highlight Row1: that contains value X and I press the delete key
and the row is deleted THEN he wants the save to change not save the
change before the value is deleted. How do I do that?

On Jan 11, 11:29 am, amiga...@gmail.com wrote:
>I am sorry they did not help me at all. According to these two tips
I am suppose to make make my very own subroutine that have the delete
code in it then make a button where it will delete the rows...what I
want is a handler to fire when I highlight a single row and push the
delete button in the keyboard. I know how to do the other one easily
however I don't know how to do this...here is why I need it. We have
a shipping program that sometimes have a complete row with null
value, this causes this program to halt with an error of a null
value, we naturally want to delete that row and upload the inventory
in the server, however in order to do that we must first click the
button save before we upload that. We want to skip that process in
such away that when we delete that row (null values) it automatically
saves it so that we just click one button which is called upload
instead of SAVE button THEN Upload button. How to catch an event
handler when the user highlights that row and pushes the delete
button? I have been in that website and they failed miserably in
assisting me in my problem. Can anyone here help me please? Thanks in
advance.

On Jan 11, 11:20 am, Michael Nemtsev <nemt...@msn.comwrote:
>>Hello amiga...@gmail.com,

http://www.syncfusion.com/FAQ/aspnet...qhttp://www.sy
n...

---
WBR,
Michael Nemtsev [C# MVP] :: blog:http://spaces.live.com/laflour
"The greatest danger for most of us is not that our aim is too high
and we miss it, but that it is too low and we reach it" (c)
Michelangelo

Hello,

I have one basic simple question. When I have multiple records in
the datagrid as follows:

Code Product 1 Product 2 Product 3
11111 A B C
22222 D E F
33333 G H I
44444 J K L
I want when the user select the third row which holds the following
value: 33333, G, H, and I and presses the Delete key in the
keyboard a
prompt message pops up saying: Are you sure you wish to delete
record
# 3333? If the user selects YES then it deletes that row. I know
how
to do the rest what I don't know how to do is catch and trap the
delete key when that row is select to prompt that message. Can
anyone
help me please? Thanks in advance.

Jan 11 '07 #6

P: n/a
But can this event .RowDeleted be available in the datagrid object? I
am not using datatable, I am using datagrid...two different objects,
no? I did a trick called timer, using my dicovery above I triggered
the timer to be enabled true then after the row deleted the timer
executed what ever code resides there then IMMEDIATLY DISABLED itself
and stopped right away as to not to repeat the code again and again. I
consider this...PLAY around the game or hack your WAY through or be
imaginative..however if there is a more professional way of an approach
it will be greatly appreciate it. I know datagrid is not the same as
datatable, so how do I get the same result from datatable with
datagrid?

On Jan 11, 11:53 am, Michael Nemtsev <nemt...@msn.comwrote:
Hello amiga...@gmail.com,

Sorry for the wrong info relating to my post - missed your point :)

About post-delete action. Why not to perform your custom tast on DataTable.RowDeleted
event?

---
WBR,
Michael Nemtsev [C# MVP] :: blog:http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo
Right but now I am in a different delima..my boss wants the event to
occure AFTER the row is deleted not before the row is deleted. For
example
Row1: contains value X
When highlight Row1: that contains value X and I press the delete key
and the row is deleted THEN he wants the save to change not save the
change before the value is deleted. How do I do that?
On Jan 11, 11:29 am, amiga...@gmail.com wrote:
I am sorry they did not help me at all. According to these two tips
I am suppose to make make my very own subroutine that have the delete
code in it then make a button where it will delete the rows...what I
want is a handler to fire when I highlight a single row and push the
delete button in the keyboard. I know how to do the other one easily
however I don't know how to do this...here is why I need it. We have
a shipping program that sometimes have a complete row with null
value, this causes this program to halt with an error of a null
value, we naturally want to delete that row and upload the inventory
in the server, however in order to do that we must first click the
button save before we upload that. We want to skip that process in
such away that when we delete that row (null values) it automatically
saves it so that we just click one button which is called upload
instead of SAVE button THEN Upload button. How to catch an event
handler when the user highlights that row and pushes the delete
button? I have been in that website and they failed miserably in
assisting me in my problem. Can anyone here help me please? Thanks in
advance.
On Jan 11, 11:20 am, Michael Nemtsev <nemt...@msn.comwrote:
>Hello amiga...@gmail.com,
>>http://www.syncfusion.com/FAQ/aspnet...qhttp://www.sy
n...
>---
WBR,
Michael Nemtsev [C# MVP] :: blog:http://spaces.live.com/laflour
"The greatest danger for most of us is not that our aim is too high
and we miss it, but that it is too low and we reach it" (c)
Michelangelo
>>Hello,
>>I have one basic simple question. When I have multiple records in
the datagrid as follows:
>>Code Product 1 Product 2 Product 3
11111 A B C
22222 D E F
33333 G H I
44444 J K L
I want when the user select the third row which holds the following
value: 33333, G, H, and I and presses the Delete key in the
keyboard a
prompt message pops up saying: Are you sure you wish to delete
record
# 3333? If the user selects YES then it deletes that row. I know
how
to do the rest what I don't know how to do is catch and trap the
delete key when that row is select to prompt that message. Can
anyone
help me please? Thanks in advance.
Jan 11 '07 #7

P: n/a
I think you can better accomplish this by making use of both the KeyUp event
for the datagrid and the rowdeleted even on the datatable. You wouldn't
need a timer.

Datagrid
OnKeyPress()
If KeyDelete then
If msgbox("Are you sure?") = dialogResult.yes then
row.delete
DataTable
OnRowDeleted
PerformSave
UpdateDatagrid

If you are not using a datatable, you must be using a list of somesort. The
list either has notification events already, or you can simply add them and
then handle them.

If you are not using a datatable and are binding to a list of object, I
recommend that you use a BindingList. It has all the provisions to do as
you are asking.
<am******@gmail.comwrote in message
news:11**********************@i39g2000hsf.googlegr oups.com...
But can this event .RowDeleted be available in the datagrid object? I
am not using datatable, I am using datagrid...two different objects,
no? I did a trick called timer, using my dicovery above I triggered
the timer to be enabled true then after the row deleted the timer
executed what ever code resides there then IMMEDIATLY DISABLED itself
and stopped right away as to not to repeat the code again and again. I
consider this...PLAY around the game or hack your WAY through or be
imaginative..however if there is a more professional way of an approach
it will be greatly appreciate it. I know datagrid is not the same as
datatable, so how do I get the same result from datatable with
datagrid?

On Jan 11, 11:53 am, Michael Nemtsev <nemt...@msn.comwrote:
>Hello amiga...@gmail.com,

Sorry for the wrong info relating to my post - missed your point :)

About post-delete action. Why not to perform your custom tast on
DataTable.RowDeleted
event?

---
WBR,
Michael Nemtsev [C# MVP] :: blog:http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and
we
miss it, but that it is too low and we reach it" (c) Michelangelo
Right but now I am in a different delima..my boss wants the event to
occure AFTER the row is deleted not before the row is deleted. For
example
Row1: contains value X
When highlight Row1: that contains value X and I press the delete key
and the row is deleted THEN he wants the save to change not save the
change before the value is deleted. How do I do that?
On Jan 11, 11:29 am, amiga...@gmail.com wrote:
>I am sorry they did not help me at all. According to these two tips
I am suppose to make make my very own subroutine that have the delete
code in it then make a button where it will delete the rows...what I
want is a handler to fire when I highlight a single row and push the
delete button in the keyboard. I know how to do the other one easily
however I don't know how to do this...here is why I need it. We have
a shipping program that sometimes have a complete row with null
value, this causes this program to halt with an error of a null
value, we naturally want to delete that row and upload the inventory
in the server, however in order to do that we must first click the
button save before we upload that. We want to skip that process in
such away that when we delete that row (null values) it automatically
saves it so that we just click one button which is called upload
instead of SAVE button THEN Upload button. How to catch an event
handler when the user highlights that row and pushes the delete
button? I have been in that website and they failed miserably in
assisting me in my problem. Can anyone here help me please? Thanks in
advance.
>On Jan 11, 11:20 am, Michael Nemtsev <nemt...@msn.comwrote:
>>Hello amiga...@gmail.com,
>>>http://www.syncfusion.com/FAQ/aspnet...qhttp://www.sy
n...
>>---
WBR,
Michael Nemtsev [C# MVP] :: blog:http://spaces.live.com/laflour
"The greatest danger for most of us is not that our aim is too high
and we miss it, but that it is too low and we reach it" (c)
Michelangelo
>>>Hello,
>>>I have one basic simple question. When I have multiple records in
the datagrid as follows:
>>>Code Product 1 Product 2 Product 3
11111 A B C
22222 D E F
33333 G H I
44444 J K L
I want when the user select the third row which holds the following
value: 33333, G, H, and I and presses the Delete key in the
keyboard a
prompt message pops up saying: Are you sure you wish to delete
record
# 3333? If the user selects YES then it deletes that row. I know
how
to do the rest what I don't know how to do is catch and trap the
delete key when that row is select to prompt that message. Can
anyone
help me please? Thanks in advance.

Jan 11 '07 #8

P: n/a
But I am simply just using datagrid. Really. That is it. Nothing more
complicated then, "I am using a datagrid." So far with datagrid it
doesn't have what you guys are talking about.

On Jan 11, 1:14 pm, "AMDRIT" <amd...@hotmail.comwrote:
I think you can better accomplish this by making use of both the KeyUp event
for the datagrid and the rowdeleted even on the datatable. You wouldn't
need a timer.

Datagrid
OnKeyPress()
If KeyDelete then
If msgbox("Are you sure?") = dialogResult.yes then
row.delete

DataTable
OnRowDeleted
PerformSave
UpdateDatagrid

If you are not using a datatable, you must be using a list of somesort. The
list either has notification events already, or you can simply add them and
then handle them.

If you are not using a datatable and are binding to a list of object, I
recommend that you use a BindingList. It has all the provisions to do as
you are asking.

<amiga...@gmail.comwrote in messagenews:11**********************@i39g2000hsf.g ooglegroups.com...
But can this event .RowDeleted be available in the datagrid object? I
am not using datatable, I am using datagrid...two different objects,
no? I did a trick called timer, using my dicovery above I triggered
the timer to be enabled true then after the row deleted the timer
executed what ever code resides there then IMMEDIATLY DISABLED itself
and stopped right away as to not to repeat the code again and again. I
consider this...PLAY around the game or hack your WAY through or be
imaginative..however if there is a more professional way of an approach
it will be greatly appreciate it. I know datagrid is not the same as
datatable, so how do I get the same result from datatable with
datagrid?
On Jan 11, 11:53 am, Michael Nemtsev <nemt...@msn.comwrote:
Hello amiga...@gmail.com,
Sorry for the wrong info relating to my post - missed your point :)
About post-delete action. Why not to perform your custom tast on
DataTable.RowDeleted
event?
---
WBR,
Michael Nemtsev [C# MVP] :: blog:http://spaces.live.com/laflour
"The greatest danger for most of us is not that our aim is too high and
we
miss it, but that it is too low and we reach it" (c) Michelangelo
Right but now I am in a different delima..my boss wants the event to
occure AFTER the row is deleted not before the row is deleted. For
example
Row1: contains value X
When highlight Row1: that contains value X and I press the delete key
and the row is deleted THEN he wants the save to change not save the
change before the value is deleted. How do I do that?
On Jan 11, 11:29 am, amiga...@gmail.com wrote:
I am sorry they did not help me at all. According to these two tips
I am suppose to make make my very own subroutine that have the delete
code in it then make a button where it will delete the rows...what I
want is a handler to fire when I highlight a single row and push the
delete button in the keyboard. I know how to do the other one easily
however I don't know how to do this...here is why I need it. We have
a shipping program that sometimes have a complete row with null
value, this causes this program to halt with an error of a null
value, we naturally want to delete that row and upload the inventory
in the server, however in order to do that we must first click the
button save before we upload that. We want to skip that process in
such away that when we delete that row (null values) it automatically
saves it so that we just click one button which is called upload
instead of SAVE button THEN Upload button. How to catch an event
handler when the user highlights that row and pushes the delete
button? I have been in that website and they failed miserably in
assisting me in my problem. Can anyone here help me please? Thanks in
advance.
On Jan 11, 11:20 am, Michael Nemtsev <nemt...@msn.comwrote:
>Hello amiga...@gmail.com,
>>http://www.syncfusion.com/FAQ/aspnet...qhttp://www.sy
n...
>---
WBR,
Michael Nemtsev [C# MVP] :: blog:http://spaces.live.com/laflour
"The greatest danger for most of us is not that our aim is too high
and we miss it, but that it is too low and we reach it" (c)
Michelangelo
>>Hello,
>>I have one basic simple question. When I have multiple records in
the datagrid as follows:
>>Code Product 1 Product 2 Product 3
11111 A B C
22222 D E F
33333 G H I
44444 J K L
I want when the user select the third row which holds the following
value: 33333, G, H, and I and presses the Delete key in the
keyboard a
prompt message pops up saying: Are you sure you wish to delete
record
# 3333? If the user selects YES then it deletes that row. I know
how
to do the rest what I don't know how to do is catch and trap the
delete key when that row is select to prompt that message. Can
anyone
help me please? Thanks in advance.
Jan 11 '07 #9

P: n/a
Your paradigm is far different from expectations of those of us throwing out
suggestions. No offense. I simply have a question, how do you populate
the datagrid without specifying a datasource, every day is an opportunity to
learn something new. I just do not see any methods for adding rows manually
to the datagrid.
<am******@gmail.comwrote in message
news:11**********************@i39g2000hsf.googlegr oups.com...
But I am simply just using datagrid. Really. That is it. Nothing more
complicated then, "I am using a datagrid." So far with datagrid it
doesn't have what you guys are talking about.

On Jan 11, 1:14 pm, "AMDRIT" <amd...@hotmail.comwrote:
>I think you can better accomplish this by making use of both the KeyUp
event
for the datagrid and the rowdeleted even on the datatable. You wouldn't
need a timer.

Datagrid
OnKeyPress()
If KeyDelete then
If msgbox("Are you sure?") = dialogResult.yes then
row.delete

DataTable
OnRowDeleted
PerformSave
UpdateDatagrid

If you are not using a datatable, you must be using a list of somesort.
The
list either has notification events already, or you can simply add them
and
then handle them.

If you are not using a datatable and are binding to a list of object, I
recommend that you use a BindingList. It has all the provisions to do as
you are asking.

<amiga...@gmail.comwrote in
messagenews:11**********************@i39g2000hsf. googlegroups.com...
But can this event .RowDeleted be available in the datagrid object? I
am not using datatable, I am using datagrid...two different objects,
no? I did a trick called timer, using my dicovery above I triggered
the timer to be enabled true then after the row deleted the timer
executed what ever code resides there then IMMEDIATLY DISABLED itself
and stopped right away as to not to repeat the code again and again. I
consider this...PLAY around the game or hack your WAY through or be
imaginative..however if there is a more professional way of an approach
it will be greatly appreciate it. I know datagrid is not the same as
datatable, so how do I get the same result from datatable with
datagrid?
On Jan 11, 11:53 am, Michael Nemtsev <nemt...@msn.comwrote:
Hello amiga...@gmail.com,
>Sorry for the wrong info relating to my post - missed your point :)
>About post-delete action. Why not to perform your custom tast on
DataTable.RowDeleted
event?
>---
WBR,
Michael Nemtsev [C# MVP] :: blog:http://spaces.live.com/laflour
>"The greatest danger for most of us is not that our aim is too high
and
we
miss it, but that it is too low and we reach it" (c) Michelangelo
Right but now I am in a different delima..my boss wants the event to
occure AFTER the row is deleted not before the row is deleted. For
example
Row1: contains value X
When highlight Row1: that contains value X and I press the delete
key
and the row is deleted THEN he wants the save to change not save the
change before the value is deleted. How do I do that?
On Jan 11, 11:29 am, amiga...@gmail.com wrote:
>I am sorry they did not help me at all. According to these two
tips
I am suppose to make make my very own subroutine that have the
delete
code in it then make a button where it will delete the rows...what
I
want is a handler to fire when I highlight a single row and push
the
delete button in the keyboard. I know how to do the other one
easily
however I don't know how to do this...here is why I need it. We
have
a shipping program that sometimes have a complete row with null
value, this causes this program to halt with an error of a null
value, we naturally want to delete that row and upload the
inventory
in the server, however in order to do that we must first click the
button save before we upload that. We want to skip that process in
such away that when we delete that row (null values) it
automatically
saves it so that we just click one button which is called upload
instead of SAVE button THEN Upload button. How to catch an event
handler when the user highlights that row and pushes the delete
button? I have been in that website and they failed miserably in
assisting me in my problem. Can anyone here help me please? Thanks
in
advance.
>On Jan 11, 11:20 am, Michael Nemtsev <nemt...@msn.comwrote:
>>Hello amiga...@gmail.com,
>>>http://www.syncfusion.com/FAQ/aspnet...qhttp://www.sy
n...
>>---
WBR,
Michael Nemtsev [C# MVP] :: blog:http://spaces.live.com/laflour
"The greatest danger for most of us is not that our aim is too
high
and we miss it, but that it is too low and we reach it" (c)
Michelangelo
>>>Hello,
>>>I have one basic simple question. When I have multiple records in
the datagrid as follows:
>>>Code Product 1 Product 2 Product 3
11111 A B C
22222 D E F
33333 G H I
44444 J K L
I want when the user select the third row which holds the
following
value: 33333, G, H, and I and presses the Delete key in the
keyboard a
prompt message pops up saying: Are you sure you wish to delete
record
# 3333? If the user selects YES then it deletes that row. I know
how
to do the rest what I don't know how to do is catch and trap the
delete key when that row is select to prompt that message. Can
anyone
help me please? Thanks in advance.

Jan 11 '07 #10

P: n/a
You are right I ment absolutely no offense, forgive me if I sounded
rude. Ones again that is not my intention :) Here let me paste the
code:

With dgRATemp
.DataSource = ds.Tables("Local")
.TableStyles.Clear()
.CaptionText = "
End With

With tableStyle
.MappingName = "Local"
.RowHeaderWidth = 5
.PreferredRowHeight = 5

With .GridColumnStyles

.Add(New DataGridTextBoxColumn)
With .Item(0)

.MappingName = "ID"
.HeaderText = "ID"
.Width = 0
.ReadOnly = True

End With
.Add(New DataGridTextBoxColumn)
With .Item(1)

.MappingName = "RANumber"
.HeaderText = "RANumber"
.Width = 0
.ReadOnly = True

End With

.Add(New DataGridTextBoxColumn)
With .Item(2)
.MappingName = "PromoItem"
.HeaderText = "PromoItem"
.Width = 120
.NullText = String.Empty
.ReadOnly = True
End With
.Add(New DataGridTextBoxColumn)
With .Item(3)

.MappingName = "ItemNumber"
.HeaderText = "ItemNumber"
.Width = 120
.ReadOnly = True

End With

.Add(New DataGridTextBoxColumn)
With .Item(4)
.MappingName = "TotalQtyPer"
.HeaderText = "Location"
.ReadOnly = True
.Width = 100

End With

.Add(New DataGridTextBoxColumn)
With .Item(5)
.MappingName = "Qty"
.HeaderText = "Qty"
.Width = 60
.ReadOnly = False
.NullText = 0
End With

.Add(New DataGridTextBoxColumn)
With .Item(6)
.MappingName = "Def"
.HeaderText = "Def"
.Width = 60
.ReadOnly = False
.NullText = 0
End With
.Add(New DataGridTextBoxColumn)
With .Item(7)
.MappingName = "PromoBit"
.HeaderText = "PromoBit"
.Width = 0
.ReadOnly = True
.NullText = 0

End With

.Add(New DataGridTextBoxColumn)
With .Item(8)
.MappingName = "DateModified"
.HeaderText = "Mod"
.Width = 0
.ReadOnly = True
.NullText = Now()

End With
End With
End With
dgRATemp.TableStyles.Add(tableStyle)

On Jan 11, 1:48 pm, "AMDRIT" <amd...@hotmail.comwrote:
Your paradigm is far different from expectations of those of us throwing out
suggestions. No offense. I simply have a question, how do you populate
the datagrid without specifying a datasource, every day is an opportunity to
learn something new. I just do not see any methods for adding rows manually
to the datagrid.

<amiga...@gmail.comwrote in messagenews:11**********************@i39g2000hsf.g ooglegroups.com...
But I am simply just using datagrid. Really. That is it. Nothing more
complicated then, "I am using a datagrid." So far with datagrid it
doesn't have what you guys are talking about.
On Jan 11, 1:14 pm, "AMDRIT" <amd...@hotmail.comwrote:
I think you can better accomplish this by making use of both the KeyUp
event
for the datagrid and the rowdeleted even on the datatable. You wouldn't
need a timer.
Datagrid
OnKeyPress()
If KeyDelete then
If msgbox("Are you sure?") = dialogResult.yes then
row.delete
DataTable
OnRowDeleted
PerformSave
UpdateDatagrid
If you are not using a datatable, you must be using a list of somesort.
The
list either has notification events already, or you can simply add them
and
then handle them.
If you are not using a datatable and are binding to a list of object, I
recommend that you use a BindingList. It has all the provisions to do as
you are asking.
<amiga...@gmail.comwrote in
messagenews:11**********************@i39g2000hsf.g ooglegroups.com...
But can this event .RowDeleted be available in the datagrid object? I
am not using datatable, I am using datagrid...two different objects,
no? I did a trick called timer, using my dicovery above I triggered
the timer to be enabled true then after the row deleted the timer
executed what ever code resides there then IMMEDIATLY DISABLED itself
and stopped right away as to not to repeat the code again and again. I
consider this...PLAY around the game or hack your WAY through or be
imaginative..however if there is a more professional way of an approach
it will be greatly appreciate it. I know datagrid is not the same as
datatable, so how do I get the same result from datatable with
datagrid?
On Jan 11, 11:53 am, Michael Nemtsev <nemt...@msn.comwrote:
Hello amiga...@gmail.com,
Sorry for the wrong info relating to my post - missed your point :)
About post-delete action. Why not to perform your custom tast on
DataTable.RowDeleted
event?
---
WBR,
Michael Nemtsev [C# MVP] :: blog:http://spaces.live.com/laflour
"The greatest danger for most of us is not that our aim is too high
and
we
miss it, but that it is too low and we reach it" (c) Michelangelo
Right but now I am in a different delima..my boss wants the event to
occure AFTER the row is deleted not before the row is deleted. For
example
Row1: contains value X
When highlight Row1: that contains value X and I press the delete
key
and the row is deleted THEN he wants the save to change not save the
change before the value is deleted. How do I do that?
On Jan 11, 11:29 am, amiga...@gmail.com wrote:
I am sorry they did not help me at all. According to these two
tips
I am suppose to make make my very own subroutine that have the
delete
code in it then make a button where it will delete the rows...what
I
want is a handler to fire when I highlight a single row and push
the
delete button in the keyboard. I know how to do the other one
easily
however I don't know how to do this...here is why I need it. We
have
a shipping program that sometimes have a complete row with null
value, this causes this program to halt with an error of a null
value, we naturally want to delete that row and upload the
inventory
in the server, however in order to do that we must first click the
button save before we upload that. We want to skip that process in
such away that when we delete that row (null values) it
automatically
saves it so that we just click one button which is called upload
instead of SAVE button THEN Upload button. How to catch an event
handler when the user highlights that row and pushes the delete
button? I have been in that website and they failed miserably in
assisting me in my problem. Can anyone here help me please? Thanks
in
advance.
On Jan 11, 11:20 am, Michael Nemtsev <nemt...@msn.comwrote:
>Hello amiga...@gmail.com,
>>http://www.syncfusion.com/FAQ/aspnet...qhttp://www.sy
n...
>---
WBR,
Michael Nemtsev [C# MVP] :: blog:http://spaces.live.com/laflour
"The greatest danger for most of us is not that our aim is too
high
and we miss it, but that it is too low and we reach it" (c)
Michelangelo
>>Hello,
>>I have one basic simple question. When I have multiple records in
the datagrid as follows:
>>Code Product 1 Product 2 Product 3
11111 A B C
22222 D E F
33333 G H I
44444 J K L
I want when the user select the third row which holds the
following
value: 33333, G, H, and I and presses the Delete key in the
keyboard a
prompt message pops up saying: Are you sure you wish to delete
record
# 3333? If the user selects YES then it deletes that row. I know
how
to do the rest what I don't know how to do is catch and trap the
delete key when that row is select to prompt that message. Can
anyone
help me please? Thanks in advance.
Jan 11 '07 #11

This discussion thread is closed

Replies have been disabled for this discussion.