Updating a text box to scroll

retro

Registered User.
Local time
Today, 15:54
Joined
Sep 5, 2003
Messages
69
OK, this one is doing my head in!

I'm using aleb's most handy code from this thread to have a multi select list box that determines recipients of an e-mail from the list.

I thought it would be handy to have it make a list that updates at the same time, showing what e-mail addresses will be sent. Here's the code I used:

Code:
Private Sub lstMailTo_Click()
Dim varItem As Variant
Dim strList As String
[COLOR="red"]Dim strElist As String[/COLOR]

Me.cmdEmail.Enabled = True
With Me!lstMailTo
    If .MultiSelect = 0 Then
        Me!txtSelected = .Value
    Else
        For Each varItem In .ItemsSelected
            strList = strList & .Column(0, varItem) & ";"
            [COLOR="Red"]strElist = strElist & .Column(0, varItem) & vbNewLine[/COLOR]        Next varItem
        If strList = "" Then
            Me!txtSelected = strList
            Me.cmdEmail.Enabled = False
            [COLOR="red"]Me!txtEadd = ""[/COLOR]
        Else
            strList = Left$(strList, Len(strList) - 1)
            Me!txtSelected = strList
            [COLOR="red"]Me!txtEadd = strElist[/COLOR]
        End If
    End If
End With
End Sub

The code works, but when the text box becomes filled, you cannot see the bottom of the list.
  1. How can I set it to know this and automatically put a scroll bar in, so the addresses can be reviewed before hitting send?
  2. I was interested to see if I could do something similar, but instead have a label display just the last item selected. I tried strElist = .Column(0, varItem) and setting the label caption to strElist, but this only displayed the first item selected. How would I do this?

Many thanks in advance for any assistance!
 
The answer seems suspeciously easy
In the properties of your txtEadd box change "scroll bars" from "none" to "vertical"
 

Users who are viewing this thread

Back
Top Bottom