Solved

Transfer multi selection from list box to text box

Posted on 2011-09-07
4
366 Views
Last Modified: 2012-05-12
Hello all

I have a list box (check style) in form45.

What i want to do it to be able to select, 1 or more selection from the list and when i click on the button, it will transfer all items selected from the list in my Form44.carrier_names (Textbox).

For ex: if i have only once selected in my list box, called "26". Then it will put "26" in my Form44.carrier_names (Textbox).

But is i have for example 3 selection, "08" "21" and "28". then it will transfert to the text box like this:
08
21
28



How can i do this please.

Thanks again for your help.


Form44.carrier_names = form45. List1

Open in new window


save-from-list.JPG
0
Comment
Question by:Wilder1626
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 47

Expert Comment

by:Martin Liss
ID: 36499524
Set the Multiline property of the textbox to True. Then loop through the Listitems looking for those selected and then add them with vbCrLf at the end of each one.
0
 
LVL 47

Accepted Solution

by:
Martin Liss earned 500 total points
ID: 36499538
Like so


Dim lngIndex As Long

For lngIndex = 0 To List1.ListCount - 1
    If List1.Selected(lngIndex) Then
        Text1.Text = Text1.Text & List1.List(lngIndex) & vbCrLf
    End If
Next

Open in new window

0
 
LVL 11

Author Closing Comment

by:Wilder1626
ID: 36499573
Thanks, this is perfect
0
 
LVL 47

Expert Comment

by:Martin Liss
ID: 36499577
Thanks. If you want to get rid of the last vbCrLf do

Text1.Text = Left$(Text1.Text, Len(Text1.Text) - 2)
0

Featured Post

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question