We help IT Professionals succeed at work.

VB.Net DataGrid Removing the last empty row

sgs1970
sgs1970 asked
on
Medium Priority
1,148 Views
Last Modified: 2008-03-10

 Hi,
   I am developing a vb.net windows application . The data is shown on a datagrid. Some of the textboxes are editable and some are not. I have also a checkbox column on the datagrid, which is editable .

Is there a way to remove the last empty row appearing on the datagrid? If the datagrid is readonly the last empty row is not appearing  , but I have to make  some columns editable.


 Thanks,
    samson

   
 
Comment
Watch Question

Author

Commented:
For checkbox to respond at single click, I added the fix from what is seen at

 http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwinforms/html/wnf_CustDataGrid.asp
Under the heading
 ----  Customization 3: Make the Check Box Respond to One Click --

But because of this empty final row with the checkbox, clicking on the checkbox, gives additional empty row and clicking on this check box creates another empty new row. This is the real issue that I am facing. Atleast Preventing additional rows to come up will be a solution

Sam
write this code in frm
frm - your formulario
dg - your Datagrid

Dim cm As CurrencyManager = _
         CType(Frm.BindingContext(dg.DataSource, dg.DataMember), _
         CurrencyManager)
      CType(cm.List, DataView).AllowNew = False

or

CType(dg.DataSource, DataView).AllowNew=False

Can your problem???

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.