تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
هل بشرح بسيط عن الـ MultiThread في c#
#1
السلام عليكم ورحمة الله وبر كاته

هل بشرح بسيط عن الـ MultiThread في c#
بسي شارب خاص لاني اعرف في فيجوال بيسك دوت نت
Lable1.invoke(sub() Label1.text="111")
لكن كيف بالسي شارب لم اجد شرح حولها الا بالكونسول


ونص الخطأ او كل تفاصيله:
PHP كود :
System.ArgumentOutOfRangeException
  HResult
=0x80131502
  Message
=الفهرس خارج النطاقيجب ألا يكون قيمته سالبة ويجب ألا يكون أقل من حجم المجموعة.
اسم المعلمةindex
  Source
=mscorlib
  StackTrace
:
 
  at System.Collections.ArrayList.get_Item(Int32 index)
 
  at System.Windows.Forms.DataGridViewRowCollection.SharedRow(Int32 rowIndex)
 
  at System.Windows.Forms.DataGridView.ScrollRowsByHeight(Int32 height)
 
  at System.Windows.Forms.DataGridView.set_VerticalOffset(Int32 value)
 
  at System.Windows.Forms.DataGridView.DataGridViewVScrolled(Object senderScrollEventArgs se)
 
  at System.Windows.Forms.ScrollBar.OnScroll(ScrollEventArgs se)
 
  at System.Windows.Forms.ScrollBar.DoScroll(ScrollEventType type)
 
  at System.Windows.Forms.ScrollBar.WmReflectScroll(Messagem)
 
  at System.Windows.Forms.ScrollBar.WndProc(Messagem)
 
  at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Messagem)
 
  at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Messagem)
 
  at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWndInt32 msgIntPtr wparamIntPtr lparam)
 
  at System.Windows.Forms.UnsafeNativeMethods.SendMessage(HandleRef hWndInt32 msgIntPtr wParamIntPtr lParam)
 
  at System.Windows.Forms.Control.SendMessage(Int32 msgIntPtr wparamIntPtr lparam)
 
  at System.Windows.Forms.Control.ReflectMessageInternal(IntPtr hWndMessagem)
 
  at System.Windows.Forms.Control.WndProc(Messagem)
 
  at System.Windows.Forms.DataGridView.WndProc(Messagem)
 
  at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Messagem)
 
  at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Messagem)
 
  at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWndInt32 msgIntPtr wparamIntPtr lparam)
 
  at System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr wndProcIntPtr hWndInt32 msgIntPtr wParamIntPtr lParam)
 
  at System.Windows.Forms.NativeWindow.DefWndProc(Messagem)
 
  at System.Windows.Forms.Control.DefWndProc(Messagem)
 
  at System.Windows.Forms.Control.WmMouseDown(MessagemMouseButtons buttonInt32 clicks)
 
  at System.Windows.Forms.Control.WndProc(Messagem)
 
  at System.Windows.Forms.ScrollBar.WndProc(Messagem)
 
  at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Messagem)
 
  at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Messagem)
 
  at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWndInt32 msgIntPtr wparamIntPtr lparam)
 
  at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSGmsg)
 
  at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentIDInt32 reasonInt32 pvLoopData)
 
  at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reasonApplicationContext context)
 
  at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reasonApplicationContext context)
 
  at System.Windows.Forms.Application.Run(Form mainForm)
 
  at WindowsFormsApp1.Program.Main() in E:\vs2022\cs\ExcelBook_cs\ExcelBook_cs\Program.cs:line 29 

الكود المسبب هو:
PHP كود :
           lblrowscount.Invoke((MethodInvoker)delegate lblrowscount.Text "عدد الصفوف المستخدمة: " xlrange.Rows.Count.ToString(); }); 
و كذلك التالي:
PHP كود :
           btndelAll.Invoke((MethodInvoker)delegate btndelAll.Enabled true; }); 
اللهم إني أعوذ بك من غلبة الدين وغلبة العدو، اللهم إني أعوذ بك من جهد البلاء ومن درك الشقاء ومن سوء القضاء ومن شماتة الأعداء
اللهم اغفر لي خطيئتي وجهلي، وإسرافي في أمري وما أنت أعلم به مني، اللهم اغفر لي ما قدمت وما أخرت، وما أسررت وما أعلنت وما أنت أعلم به مني، أنت المقدم وأنت المؤخر وأنت على كل شيء قدير
الرد }}}
تم الشكر بواسطة:


الردود في هذا الموضوع
هل بشرح بسيط عن الـ MultiThread في c# - بواسطة justforit - 13-04-24, 06:38 AM


التنقل السريع :


يقوم بقرائة الموضوع: