Results 1 to 6 of 6

Thread: transfer contents from listbox over forms!! please help

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2015
    Posts
    9

    transfer contents from listbox over forms!! please help

    hey!
    does anyone know how to transfer contents from listbox 1 in form 1 to either a another listbox ( listbox2) or a richtextbox in form 2 ?

    thanks

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    105,448

    Re: transfer contents from listbox over forms!! please help

    Follow the Blog link in my signature and read my three-part post on Data Among Multiple Forms.

  3. #3

    Thread Starter
    New Member
    Join Date
    Mar 2015
    Posts
    9

    Re: transfer contents from listbox over forms!! please help

    thank alot!!
    one more Question, does this work with listboxes too? i tried it and it wouldnt work

  4. #4
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    105,448

    Re: transfer contents from listbox over forms!! please help

    Quote Originally Posted by been546 View Post
    thank alot!!
    one more Question, does this work with listboxes too? i tried it and it wouldnt work
    It makes absolutely no difference where the data comes from where it goes to. Moving it between two forms is EXACTLY the same regardless. If what you did didn't work then you did it wrong. If you don't show us what you did then we can't tell you what's wrong with it.

  5. #5

    Thread Starter
    New Member
    Join Date
    Mar 2015
    Posts
    9

    Re: transfer contents from listbox over forms!! please help

    this was on form 2 :

    Private Sub frmPayment_FormClosed(sender As Object, e As FormClosedEventArgs) Handles Me.FormClosed

    'Push the data to the TextBox on the first form from the TextBox on this form.
    frmMain.lstCalculator.Text = Me.ListBox1.Text
    End Sub



    Private Sub frmPayment_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    'Pull the data from the TextBox on the first form to the TextBox on the this form.
    Me.ListBox1.Text = frmMain.lstCalculator.Text
    End Sub

    this was form 1:

    'Show the second form as a modal dialogue.
    frmPayment.ShowDialog()

  6. #6
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    105,448

    Re: transfer contents from listbox over forms!! please help

    At a glance I would say that the FormClosed event is raised after the items have been removed from the ListBox and therefore the Text is Nothing. Try handling the FormClosing event instead, as it is raised before the form is disposed.

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