datagrid, delete record from table

S

schapopa

Hi,

I have a contextmenu when user right click on the datagrid first column
- delete row from datagrid.

My code for that looks like this:

Private Sub MenuItem1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MenuItem1.Click
ds.Tables(0).Rows.RemoveAt(myHitTest.Row)
End Sub

where my hittest comes from mouse_down event.
Everything works fine untill I insert value in the datagrid and then try
to delete it. Then I get an error that there is no row at the position.
Does anyone has any suggestions?
Thank you
Schapopa
 
S

schapopa

Hi,

Does anybody have any suggestion how differently I can do what I want to
achieve. I want to create right click context menu and be able to delete
and add records with that menu.
I thought it should be easy but I just cannot find a way to do that.
Regars

Schapopa
 
S

schapopa

Hi,

Does anybody have any suggestion how differently I can do what I want to
achieve. I want to create right click context menu and be able to delete
and add records with that menu.
I thought it should be easy but I just cannot find a way to do that.
Regars

Schapopa
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Getting Data from the DataGrid. 3
Call a Sub 6
ContextMenu 3
filling a datagrid 1
Debugging Error 1
datagrid Add 2
How to set values in datagrid? 6
Problem with datagridview 2

Top