• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 524
  • 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
 
Jorge PaulinoIT Pro/DeveloperCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

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