Thanks for your answers!
Erel, I already use asyncstreams for serial port, it's working very well.
Jmon, I tried with CallSubDelay2, but it didn't work, we still stay freeze until the transfert is complete. I think it's because of the loop.
So I keeped your idea of delayed function using a timer.
When I started my upload function, I start a timer, and I used the timer_tick function to send lines one after each other.
In the _tick function I update a progressbar and the count of transfered line in a textfield and it's working very well!
Thank you all for your help!
Pietro
public Sub upload_file(nom_fichier As String,edit As TextArea)
upload_timer.Initialize("upload_timer_loop", Main.upload_delay)
serial.write_com_port_cr("load "&nom_fichier)
' init upload list
upload_list.Initialize
upload_list.AddAll(Regex.Split(CRLF, edit.text))
upload_ptr = 0
Main.upload_progress.Visible = True
Main.upload_progress.Progress = 0
upload_timer.Enabled = True
Log("start upload")
End Sub
' Example: setProgressBarValue(progressbarMain, 0.90)
Sub upload_timer_loop_tick
upload_ptr = upload_ptr +1
If upload_ptr = upload_list.Size Then
upload_timer.Enabled = False
serial.write_com_port_cr(Chr(3))
Main.upload_progress.Visible = False
Log ("end of upload")
Else
Dim ch As String
ch = upload_list.Get(upload_ptr)
serial.write_com_port_cr(ch)
End If
Main.t_progress_1.Text =upload_ptr& "/"& upload_list.Size
Main.upload_progress.Progress = upload_ptr/upload_list.Size
End Sub