Get me To add New rows in datagridview

r4k35h

Member
Joined
Sep 4, 2006
Messages
20
Programming Experience
Beginner
hi,
let me make it short and sweet to understand
I have:
1 form,1 datagridview

I need :
a buttoncolumn which creates a new row after validating 5 fields (4STRINGS,1 numeric)(for now no database connection)

What I was able to do:
create the column button and make new rows when the button is clicked

Problem:
New rows are created more than once if the same button is clicked

Code:

VB.NET:
[FONT=Trebuchet MS]Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load[/FONT]
[FONT=Trebuchet MS]DataGridView1.Columns(6).Name = "AddRows"[/FONT]
[FONT=Trebuchet MS]End Sub[/FONT]
 
[FONT=Trebuchet MS]Private Sub DataGridView1_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellClick[/FONT]
 
[FONT=Trebuchet MS]If DataGridView1.Columns(e.ColumnIndex).Name = "AddRows" Then[/FONT]
[FONT=Trebuchet MS]Me.DataGridView1.Rows.Add()[/FONT]
[FONT=Trebuchet MS]End If[/FONT]
[FONT=Trebuchet MS]End Sub[/FONT]


references:
VB.NET:
Imports System
Imports System.Drawing
Imports System.Windows.Forms


this is all I could think of in my own noobish way, please help this ignorant fool
 
Back
Top