Hi

I have a lstdata3 with 4 emails in it
and I will that thoose shall come up in
a textbox seperated with ; at the end of each.

the lstdata3 list is with the checkbox enabled
so I can choose wich I will use.

a commandbutton is used to execute the command

LstData3.Selected = True

For i = 0 To LstData3.ListCount - 1

Form1.textTo = LstData3.Selected(i) + ";"

Next i

Bonzo

try this :-

Private Sub Command1_Click()
For i = 0 To List1.ListCount - 1
If List1.Selected(i) = True Then
Text1.Text = Text1.Text + List1.List(i) + ";  "
End If
Next
End Sub

before performing this task you have to set the MultiSelect property with the value 2Extended

hope this helps you . . .

Hi

I have tried it and it works not good

Text1.Text = Text1.Text + List1.List(i) + "; "

this code generats just a string like this
bahra@westrun.grbonzo@westrun.gr;
it should be like this
bahra@westrun.gr;bonzo@westrun.gr

the given code will produce result in the following format
bahra@westrun.gr;bonzo@westrun.gr;

if you dont wanna add ; at the end then just extract string from start to string length-1
try this:-

Private Sub Command1_Click()
For i = 0 To List1.ListCount - 1
If List1.Selected(i) = True Then
Text1.Text = Text1.Text + List1.List(i) + ";"
End If
Next
Text1.Text = Mid(Text1.Text, 1, Len(Text1.Text) - 1) 'this is what you expect
End Sub

Hi

Yes it's good but I get this
2013bahra@westrun.gr;bonzo@westrun.gr

Hi

Again I solved it

Text1.Text = Mid(Text1.Text, 1, Len(Text1.Text) - 1)

Text1.Text = Mid(Text1.Text, 5, Len(Text1.Text) - 1)

I just remove the 1 and put 5 instead

thanks for all help

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.