Listview with Contextmenustrip...

C

Co

Hi All,

I have been trying to find some example code for the use of a
contextmenustrip with a Listview\
but all the things I found didn't exactly do what I wanted.
Hopefully someone can help me out here.

I have a Listview on my form. In the Listview I show records from a
database.
Now I want a pulldownmenu when I right-click on one of the Listview
items.
So far no problem,

but now I don't want the contextmenustrip to come up when I click
on the Listview where there is no item displayed.
Also I need to retrieve the field "Id" from the item which was
highlighted when I right-clicked.

So I think I need to give the Listview item a reference number
corresponding with the field " Id" of my
database table when the items are loaded into the Listview.

Marco
 
L

Lloyd Sheen

Co said:
Hi All,

I have been trying to find some example code for the use of a
contextmenustrip with a Listview\
but all the things I found didn't exactly do what I wanted.
Hopefully someone can help me out here.

I have a Listview on my form. In the Listview I show records from a
database.
Now I want a pulldownmenu when I right-click on one of the Listview
items.
So far no problem,

but now I don't want the contextmenustrip to come up when I click
on the Listview where there is no item displayed.
Also I need to retrieve the field "Id" from the item which was
highlighted when I right-clicked.

So I think I need to give the Listview item a reference number
corresponding with the field " Id" of my
database table when the items are loaded into the Listview.

Marco

Marco,

What about the code I gave you do you not understand?

LS
 
C

Co

Marco,

    What about the code I gave you do you not understand?

LS

Lloyd,

No I didn't understand.
I tried the code and it said "Label" or "0".
I need a little bit more.
I'm just a newbie, sorry

Marco
 

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

Top