Solved

insert blank rows to datagridview

Posted on 2009-04-03
4
487 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 300 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 200 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Help with LINQ and XML 10 36
Import a txt file into a DataGridView and TextBox 20 38
location of a form 2 15
get combo value in class 5 9
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

822 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