Results 1 to 2 of 2

Thread: Return data from modal form after unloading

  1. #1
    Guest
    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

  2. #2
    Lively Member
    Join Date
    Nov 2000
    Posts
    82
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width