Hi, I tried paul example but got some error:
the error occur and point me.Code:System.InvalidOperationException was unhandled Message="Cross-thread operation not valid: Control 'ListBox1' accessed from a thread other than the thread it was created on." Source="System.Windows.Forms" StackTrace: at System.Windows.Forms.Control.get_Handle() at System.Windows.Forms.Control.SendMessage(Int32 msg, Int32 wparam, Int32 lparam) at System.Windows.Forms.ListBox.get_SelectedIndex() at System.Windows.Forms.ListBox.set_SelectedIndex(Int32 value) at multithreading.frmMain.Device1() in J:\Aktif VB.net\multithreading\frmMain.vb:line 12 at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.runTryCode(Object userData) at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException:
vb Code:
ListBox1.SelectedIndex = i




Reply With Quote