|
|
Copy from ListBox to TextBox
Hi
I want the copy to have a new line for each entry but I am stuck can you help.
Private Sub Command2_Click()
Dim i As Integer
If List1.ListIndex = -1 Then Exit Sub
For i = List1.ListCount - 1 To 0 Step -1
If List1.Selected(i) = True Then
txtHold.Text = txtHold.Text & List1.List(i)
End If
Next i
List1.Visible = False
End Sub
I tried VbCrLf but that did not work.
Ron
|
|
0
|
|
|
|
Reply
|
Utf
|
6/28/2010 6:35:13 PM |
|
=?Utf-8?B?TG9uZG9uTGFk?= <LondonLad@discussions.microsoft.com> wrote:
> txtHold.Text = txtHold.Text & List1.List(i)
>
>I tried VbCrLf but that did not work.
The listbox absorbs the CRLF. So, simply add a CRLF to your string each time.
In your example:
txtHold.Text = txtHold.Text & List1.List(i) & vbCRLF
|
|
0
|
|
|
|
Reply
|
sfdavidkaye2
|
6/28/2010 6:50:16 PM
|
|
"LondonLad" <LondonLad@discussions.microsoft.com> wrote in message
news:33C7DDB4-852C-42DF-826F-DFF4A10FFA53@microsoft.com...
<cut>
> I tried VbCrLf but that did not work.
Is the MultiLine property of the textbox set True?
|
|
0
|
|
|
|
Reply
|
Bob
|
6/28/2010 6:56:43 PM
|
|
sfdavidkaye2@yahoo.com (David Kaye) wrote:
>>I tried VbCrLf but that did not work.
>
>The listbox absorbs the CRLF. So, simply add a CRLF to your string each time.
>In your example:
>
>txtHold.Text = txtHold.Text & List1.List(i) & vbCRLF
I read right past what you wrote. If the control is set to multi-line, then
CRLF is ignored. Otherwise, add the CRLF to the end of the list1 contents.
|
|
0
|
|
|
|
Reply
|
sfdavidkaye2
|
6/28/2010 7:42:02 PM
|
|
"David Kaye" <sfdavidkaye2@yahoo.com> wrote in message
news:i0atu9$jau$1@news.eternal-september.org...
> If the control is set to multi-line, then CRLF is ignored.
Huh?
|
|
0
|
|
|
|
Reply
|
Jeff
|
6/28/2010 9:50:30 PM
|
|
"Jeff Johnson" <i.get@enough.spam> wrote:
>
>> If the control is set to multi-line, then CRLF is ignored.
>
>Huh?
>
Let me try to say this again without screwing it up. If the textbox multiline
is set to true the textbox will accept (display) CRLF. If it is set to false
it will ignore CRLF.
Incidentally, in more recent versions of textbox, if you set the multiline
property to true you can load the textbox at design time with many lines of
words. It works similar to the Listbox list property. You get a drop-down
list where you can enter data. Instead of hitting enter, hit ctrl-enter to
skip to the next line.
|
|
0
|
|
|
|
Reply
|
sfdavidkaye2
|
6/28/2010 11:27:56 PM
|
|
"David Kaye" <sfdavidkaye2@yahoo.com> wrote in message
news:i0bb5s$itm$1@news.eternal-september.org...
>>> If the control is set to multi-line, then CRLF is ignored.
>>
>>Huh?
>>
>
> Let me try to say this again without screwing it up. If the textbox
> multiline
> is set to true the textbox will accept (display) CRLF. If it is set to
> false
> it will ignore CRLF.
I wouldn't so much as say it "ignores" CR and LF so much as it doesn't do
what you would expect it to do, i.e., display subsequent text on a new line.
Instead it treats CR and LF as characters and generally displays them with
the "missing character" symbol, most often a box. Not exactly what I would
call "ignore."
|
|
0
|
|
|
|
Reply
|
Jeff
|
6/29/2010 3:48:24 AM
|
|
"Jeff Johnson" <up@yours.spammers> wrote:
>I wouldn't so much as say it "ignores" CR and LF so much as it doesn't do
>what you would expect it to do, i.e., display subsequent text on a new line.
>Instead it treats CR and LF as characters and generally displays them with
>the "missing character" symbol, most often a box. Not exactly what I would
>call "ignore."
Not VB 6.0 SP 6 running on Windows XP SP 3. The textbox control simply
ignores CRLF and writes the following text immediately after the existing text
with no spaces or other characters.
|
|
0
|
|
|
|
Reply
|
sfdavidkaye2
|
6/29/2010 4:04:02 AM
|
|
"David Kaye" <sfdavidkaye2@yahoo.com> wrote in message
news:i0brbh$893$1@news.eternal-september.org...
>>I wouldn't so much as say it "ignores" CR and LF so much as it doesn't do
>>what you would expect it to do, i.e., display subsequent text on a new
>>line.
>>Instead it treats CR and LF as characters and generally displays them with
>>the "missing character" symbol, most often a box. Not exactly what I would
>>call "ignore."
>
> Not VB 6.0 SP 6 running on Windows XP SP 3. The textbox control simply
> ignores CRLF and writes the following text immediately after the existing
> text
> with no spaces or other characters.
Interesting. I KNOW I've seen this behavior before. Now I have to wonder
where....
|
|
0
|
|
|
|
Reply
|
Jeff
|
6/29/2010 2:27:29 PM
|
|
|
8 Replies
1340 Views
(page loaded in 0.692 seconds)
|
|
|
|
|
|
|
|
|