Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

insert blank rows to datagridview

Posted on 2009-04-03
4
Medium Priority
?
505 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
  • 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

886 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