-
I am showing a modal form that has a ListView object on it. The user can select a row there and then presses the "OK" button in order to close that modal form ("unload me" is called in the cmdOkay_Click procedure) and to return to the non modal form.
Now back in the non modal form, I need to know what row the user selected and the text of that row.
What's the best way to pass such information to outside of the modal form? I tried to make a global variable of type ListItem and executing
set g_SelectedListItem = ListView.SelectedItem
before unloading the form. However, when accessing that variable back in the non modal form, I get an error stating that the object has been deleted (i guess the set statement just creates a reference, not a copy - right?).
Thanks for help!
Felix
-
Where did you make the var global? A var declared in a module as global will exist throughout your app. Don't even bother with a "type" declaration. Just declare something like:
Code:
Public g_SelectedListItem As String
in the Sub Main(). Then assign it in your modal form, as:
Code:
g_SelectedListItem = ListView.SelectedItem
After you've done this, you can unload your modal form. Your var should still have the correct value.