السلام عليكــم ورحمـة الله وبركاتــه ،،
يوجد لدى مشكله فى عرض combox من خلال datagrid
حيث استخدمت هذا الكود ولكن فشل الامر
If cn.State = ConnectionState.Open Then cn.Close() cn.ConnectionString = "Data Source=SSSSS;Initial Catalog=employee company;Integrated Security=True" cn.Open() cmd.Connection = cn cmd.CommandText = "select * from job" tb.Clear() tb.Load(cmd.ExecuteReader) DataGridView1.DataSource = tb Dim cmb As DataGridViewComboBoxCell If cn.State = ConnectionState.Open Then cn.Close() cn.Open() For x As Integer = 0 To DataGridView1.Rows.Count - 1 cmd.CommandText = "select id,name from job_group" tb = Nothing tb = New DataTable tb.Load(cmd.ExecuteReader) cmb = CType(DataGridView1.Rows(x).Cells(2), DataGridViewComboBoxCell) cmb.DataSource = tb cmb.DisplayMember = "name" cmb.ValueMember = "id" Next
يظهر هذا الخطا
Unable to cast object of type 'System.Windows.Forms.DataGridViewTextBoxCell' to type 'System.Windows.Forms.DataGridViewComboBoxCell'.