Hi i have a listview control on form1. I want to send the selected value to form2.

I tried couple of ways but nothing seems to work correctly.

Please help.

I don't have VB.NET installed at the moment. Anyway, try this:

Change the Modifiers property for the listview to "public" and then try to access it from form2 like this: Form1.listView1 An example for selecting the current selected item:

Dim selectedItem as ListViewItem = Form1.listView1.SelectedItems[0]

Thanks

hi farooq,

Thanks for replying. I just tried. its not workking. I am getting the following error:
Identifier Expected.

Oh Sorry. Its a "( )" instead of "[ ]".

Use this:

Dim selectedItem as ListViewItem = Form1.listView1.SelectedItems[B]([/B]0[B])[/B]

so it gets the item selected and saves it as a listviewitem?

is there a way to cast it to a string?

Do you want to get its value?

If so then use this:

Dim listViewValue as String = Form1.listView1.SelectedItems(0).Text
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.