text box and combo box

wrens_splein

New member
Local time
Today, 18:54
Joined
Jul 3, 2003
Messages
6
Hi
I am trying to put whatever is selected ina combo box into a text on the same form. More than one selection from combo can be made but I do not know how to get the Text Box to create a new line for each selction made.
Here is the code for my combo if that helps:

Me.softlist = Me.softlist & Me.Combo30.SelText


Anyone give me some pointers?

Thanks for your help

:confused:
 
I've done something like this before, but I used a listbox to store the selections. Is there a reason you want a textbox?
 
wrens,

Code:
Me.softlist = Me.softlist & vbCrLf & Me.Combo30

Wayne
 
I just searched for how to insert a new line in vb and came up with both vbNewLine and vbCrLf. What's the difference?
 
Tiro,

Don't quote me on this, but

vbNewLine = Chr(10)

vbCrLf = Chr(10) & Chr(13)

If you are really interested, use the Search facility here because
I know I have seen this addressed before.

Wayne
 
Have you tried doing a For/Next loop and when you find an item that was selected you create a concatenated string using an embedded carriage return and line feed.

Dim strText As String

For x = 1 to Me.combo.ListIndex - 1
if Me.combo.Selecte(x) = True Then ' item selected
strText = Me.combo.ItemData(x) & char(13) & char(10)
end if
Next x

the char(13) & char(10) will embed a CR/LF and force new lines into your text box.
 

Users who are viewing this thread

Back
Top Bottom