1,105,310 Community Members

List problem with multiselect

Member Avatar
LeNenne
Junior Poster
105 posts since Nov 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

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

Member Avatar
rishif2
Posting Whiz in Training
284 posts since Dec 2012
Reputation Points: 57 [?]
Q&As Helped to Solve: 58 [?]
Skill Endorsements: 4 [?]
 
0
 

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 . . .

Member Avatar
LeNenne
Junior Poster
105 posts since Nov 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

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

Member Avatar
rishif2
Posting Whiz in Training
284 posts since Dec 2012
Reputation Points: 57 [?]
Q&As Helped to Solve: 58 [?]
Skill Endorsements: 4 [?]
 
0
 

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
Member Avatar
LeNenne
Junior Poster
105 posts since Nov 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Hi

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

Member Avatar
LeNenne
Junior Poster
105 posts since Nov 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

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

Member Avatar
LeNenne
Junior Poster
105 posts since Nov 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

thanks for all help

Question Answered as of 10 Months Ago by rishif2
You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article