|
-
May 25th, 2010, 11:59 PM
#1
Thread Starter
Lively Member
[RESOLVED] Remove Blank Row In Datagrid Control
Is there a possiblity by any chance that a blank row in datagrid will be remove ?
Let's say the datagrid has this kind of info :
Column 1 | Column 2 | Column 3
User 1 NY 290-5542
Null Null Null
User 2 CA 350-5555
Lets assume that row 2 has a data and i inputed the data in row 3, however i change my mind i deleted the data in row 2 and that will leave row 2 blank. I s there a method where i can remove the row 2.
The first thing come up on my mind was use a timer wherein it runs all the time. But it seems a bad idea though.
-
May 26th, 2010, 12:05 AM
#2
Re: Remove Blank Row In Datagrid Control
First up, is it really a DataGrid or is it actually a DataGridView? Secondly, is the grid bound or unbound, i.e. have you set its DataSource? If it's bound, what is it bound to?
-
May 26th, 2010, 12:26 AM
#3
Thread Starter
Lively Member
Re: Remove Blank Row In Datagrid Control
Datagrid or Datagridview are they two different control ?
Well the control name is Datagridview i guess ?.
Bound or Unbound ? You mean if i bind it with a datatable or dataset ? if it is, no the control will just accept a user input, i can input on a textbox column, check and uncheck on checkbox column.
-
May 26th, 2010, 12:32 AM
#4
Re: Remove Blank Row In Datagrid Control
If the grid is unbound then removing a row is pretty much as you would expect: the Rows collection has both Remove and RemoveAt methods, allowing you specify a row or a row index.
-
May 26th, 2010, 12:37 AM
#5
Thread Starter
Lively Member
Re: Remove Blank Row In Datagrid Control
Using the timer is not a problem ?. Because the first thing came up on my mind was set a for loop in the timer and check if the row is a full blank and then delete it. Or there's a professional way on doing that ?
-
May 26th, 2010, 12:41 AM
#6
Re: Remove Blank Row In Datagrid Control
I don't understand why a Timer would be needed. Who is deleting the data in the first place? If it's you in code then you would just remove the row there in code instead. If it's the user then they can simply use the Delete key to delete a row.
-
May 26th, 2010, 12:49 AM
#7
Thread Starter
Lively Member
Re: Remove Blank Row In Datagrid Control
I'm just assuming that most of the user will just leave some of rows blank and never delete it. If you take a look in post #1 the scenario. Is there an event of datagrid whereun it can trigger the blank row?
-
May 26th, 2010, 12:53 AM
#8
Re: Remove Blank Row In Datagrid Control
I would say that is an invalid assumption. Why would a user go to the trouble of deleting each individual field in a row when they can just delete the row? Maybe there are some people out there who would do it but, frankly, they must be idiots. Anyone with any sense would see that leaving a row blank means they have a blank row and, if they don't want a blank row, they should delete it. I've worked on many projects containing grids and never once has that been an issue.
-
May 26th, 2010, 02:27 AM
#9
Thread Starter
Lively Member
Re: Remove Blank Row In Datagrid Control
I guess you have the point. Well thanks jm.
by the way jm I saw a thread of yours wherein you managed to make a flip/flop vista in forms, what thread is it ?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|