Hi, Consider following line will appending text in textbox while BackgroundWorker is running asynchronously. (Based on previous treads and regarding to jmcilhinney pointed BackgroundWorkers are for huge process-occupying things not UI, you have to make it a sort of pause or invoke to access UI update thing)
This code works with warnings on underlined line. But since I'm using Option Strict = On, Mentioned line throws an error:Code:Private Sub BackgroundWorker1_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork While (CLIENT.Connected) Try RECEIVE = STREAM.ReadLine Me.Convtxt.Invoke(New MethodInvoker(Function() Convtxt.AppendText("YOU: " + RECEIVE + vbNewLine) End Function)) RECEIVE = "" Catch ex As Exception MessageBox.Show(ex.Message.ToString()) End Try End While End Sub
Cannot infer a return type. Consider adding an 'As' clause to specify the return type.
How can I rectify it?




Reply With Quote
