Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

insert blank rows to datagridview

Posted on 2009-04-03
4
Medium Priority
?
498 Views
Last Modified: 2012-05-06
Can someone give me some code in vb.net to insert blank rows into a datagridview?
0
Comment
Question by:ddepuemd
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 21

Accepted Solution

by:
Craig Wagner earned 1200 total points
ID: 24061072
You don't say whether the DataGridView is bound or unbound. Assuming it is unbound...

' Insert a single blank row
dg.Rows.Add()

' Insert a bunch of blank rows
For i As Integer = 1 To 100
     dg.Rows.Add()
Next
0
 

Author Comment

by:ddepuemd
ID: 24061408
i tried that method and it didn't work...
0
 
LVL 21

Expert Comment

by:Craig Wagner
ID: 24061969
I just wrote a prototype form that had that very code in it and it worked fine. You'll have to be (much) more specific about your application and what you're trying to do.
0
 
LVL 48

Assisted Solution

by:jpaulino
jpaulino earned 800 total points
ID: 24067488
Does the datagridview is bound to any datasource ? If so you have to insert into a new item in the datasource and you could not use the CraigWagner solution.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question