• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 514
  • Last Modified:

insert blank rows to datagridview

Can someone give me some code in vb.net to insert blank rows into a datagridview?
0
ddepuemd
Asked:
ddepuemd
  • 2
2 Solutions
 
Craig WagnerSoftware ArchitectCommented:
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
 
ddepuemdAuthor Commented:
i tried that method and it didn't work...
0
 
Craig WagnerSoftware ArchitectCommented:
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
 
jpaulinoCommented:
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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now