السلام عليكم
اخواني الاعضاء والمشرفين
لدي مصفوفة متغيرة الحجم واريد ان اعبي المصفوفة بقيمة من gridview ولكن تظهر لي مشكلة لا اعرف سببها
هذ ه هي المصفوفة
Dim clint_id() As String
Dim i As Integer = 0
For Each row As GridViewRow In GridView1.Rows
Dim chk As CheckBox = CType(row.FindControl("CheckBox1"), CheckBox)
Dim lb_ID As Label = CType(row.FindControl("Label4"), Label)
If chk.Checked = True Then
cheack_select += 1
clint_id(i) = lb_ID.Text
i += 1
End If
Next
والخطاء الذي يظهر لي هو
============
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Line 45: cheack_select += 1 Line 46: Line 47: clint_id(i) += lb_ID.Text Line 48: Line 49:
Source File: H:\taha\RegLisence\Admins\WebUserControlSend_Email.ascx.vb Line: 47
Stack Trace:
------------------ بالتحديد عند هذه السطر
clint_id(i) += lb_ID.Text
حتى وان قمت بكتابة السطر هذه بهذا الشكل
clint_id(i) = lb_ID.Text
تظهر لي نفس المشكلة
