German EditText-Feld in Liste konvertieren

peternmb

Well-Known Member
Licensed User
Longtime User
Hallo,
ich habe ein Textfeld in dem sich zeilenweise mehrere Mailadressen befinden.
Wie kann ich das in eine Liste konvertieren um die Mailadressen zu prüfen und Mails per SMTP zu versenden?

Bisher hatte ich nur ein einzeiliges Editfeld und da war das kein Problem.

Danke.
 

PaulMeuris

Well-Known Member
Licensed User
The text in the TextArea (or in B4A it is an EditText) is delimited by a CRLF.
With the "Fill combobox" (Button1) you set the B4XComboBox1 list using a List.
1759980170626.png

Here's the relevant code:
B4X:
Private Sub B4XComboBox1_SelectedIndexChanged (Index As Int)
    If Index <> 0 Then xui.MsgboxAsync(B4XComboBox1.GetItem(Index) & " selected.","Selection")
    Log(B4XComboBox1.GetItem(Index))
End Sub
Private Sub Button1_Click
    Dim strtext As String = TextArea1.Text         ' in B4A use an EditText view
    Dim lst As List = Regex.Split(CRLF,strtext)    ' CRLF is the delimiter like a comma or a semi-colon
    B4XComboBox1.SetItems(lst)   
    B4XComboBox1.cmbBox.Items.InsertAt(0,"<Select an E-mail address>")
    B4XComboBox1.SelectedIndex = 0
End Sub
The B4J source code is in the attachment.
 

Attachments

  • testenvironment62.zip
    3.5 KB · Views: 0
Top