Re: Remove last row in a unbound datagridview by gsudeesh
gsudeesh
Sun Mar 04 03:13:58 CST 2007
On Mar 3, 2:01 am, "justin creasy" <justin.cre...@gmail.com> wrote:
> On Feb 28, 9:42 am, gsude...@gmail.com wrote:
>
>
>
>
>
> > Hi All,
> > I have a undound DataGridView. That is, I am populating the
> > DataGridView using the DataGridView.Rows.Add() call and by setting the
> > values to individual cells in the row. When I am adding data to the
> > DataGridView using such a method, I am getting an unwanted row at the
> > bottom of the DataGridView. I want to avoid this row. Any help with
> > respect to this is highly appreciated.
>
> > I am not planning to use databinding for the DataGridView. Since,
> > the DataGridView has 7 columns. I should be able to sort the
> > DataGridView using any of these seven columns. If I use the
> > databinding, it will be difficult to sort the view. Hence, using the
> > Default sort of the DataGridView helps me in this case. But the
> > presence of last row in the DataGridView should not be supported.
>
> > So, please tell me a good method, using which I can remove the
> > unwanted last row in the DataGridView.
>
> > Thanx In Advance,
> >SudeeshG
>
> Sudeesh,
>
> Is the extra row being added empty and have an '*' on the left most
> portion of the row? If so your problem is that you have adding
> enabled, meaning that the user can manually enter new rows. You can
> turn this property off in Visual Studio.
>
> If you are looking at your WinForm in VS and your project is not
> running, click on the DataGridView and you should see a little arrow
> in the top right corner. Click on that once and you should see a
> number of options. Some of those options have checkboxes and one of
> them should say "Enable Adding". Make sure that it is not checked.
>
> If that doesn't solve the problem post your code for when you create
> the DataGridView, set it's attributes, and populate it's data.- Hide quoted text -
>
> - Show quoted text -
Thanx Justin,
That was the reason. I have turned off the property
AllowUsersToAddRows. Now it works. Once again thanx.
Sudeesh G