Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi

I am adding values to grid have 3 column title,Yearofachievement,descrition

VB
Private Sub xbtnAddAchievements_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles xbtnAddAchievements.Click
        Dim n As Integer = xdgvAchievements.Rows.Add()
        xdgvAchievements.Rows.Item(n).Cells(1).Value = xtxtTitle.Text
        xdgvAchievements.Rows.Item(n).Cells(2).Value = xcmbYearOfAchievements.SelectedItem
        xdgvAchievements.Rows.Item(n).Cells(3).Value = xtxtDescription.Text
        xbtnResetAchievements_Click(Nothing, Nothing)
    End Sub

I am not saving valus any where just add and remove from grid
how to remove the selcted row from the grid
Posted
Updated 20-Dec-11 23:45pm
v2
Comments
Karthik Harve 21-Dec-11 5:46am    
[Edit] pre tags added.

1 solution

use CellValidating property of grid
e.g.:

C#
private void dgvSubjects_CellValidating(object sender, DataGridViewCellValidatingEventArgs e)
{
  e.Cancel = true; 
}
 
Share this answer
 
v2
Comments
Karthik Harve 21-Dec-11 5:47am    
[Edit] pre tags added.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900