تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
[كود] DataGridViewComboBoX
#5
عزيزي  Smile

هذا كود حدث الإختيار من كمبوبكس الداتاجريد من أساتذة المنتدى وستجد فيه مكان الاستعلام  Big Grin
كود :
   Private Sub editingComboBox_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)
       Dim combo As ComboBox = TryCast(sender, ComboBox)
       If combo.Text IsNot Nothing Then
           ' الاستعلام
           Dim v = combo.Text
           Dim da As New SqlDataAdapter("SELECT * FROM [table] WHERE [column]=@c", SqlConn)
           da.SelectCommand.Parameters.AddWithValue("@c", v)
           Dim dt As New DataTable
           If da.Fill(dt) > 0 Then
               DataGridView1.CurrentRow.Cells(0).Value = dt.Rows(0)("unitPrice")
           End If
       End If
   End Sub
   Private Sub DataGridView1_EditingControlShowing(ByVal sender As Object, ByVal e As DataGridViewEditingControlShowingEventArgs) Handles DataGridView1.EditingControlShowing
       Dim c = TryCast(e.Control, ComboBox)
       If c IsNot Nothing Then
           RemoveHandler c.SelectedIndexChanged, New EventHandler(AddressOf editingComboBox_SelectedIndexChanged)
           AddHandler c.SelectedIndexChanged, New EventHandler(AddressOf editingComboBox_SelectedIndexChanged)
       End If
   End Sub
قم بتعديل ما يلزمك  Smile
الرد }}}
تم الشكر بواسطة: يونس علي , حريف برمجة


الردود في هذا الموضوع
DataGridViewComboBoX - بواسطة يونس علي - 01-05-19, 03:34 PM
RE: DataGridViewComboBoX - بواسطة يونس علي - 02-05-19, 11:47 PM
RE: DataGridViewComboBoX - بواسطة saoud2 - 02-05-19, 11:53 PM
RE: DataGridViewComboBoX - بواسطة يونس علي - 03-05-19, 12:14 AM
RE: DataGridViewComboBoX - بواسطة saoud2 - 03-05-19, 01:16 AM
RE: DataGridViewComboBoX - بواسطة يونس علي - 03-05-19, 01:57 AM

المواضيع المحتمل أن تكون متشابهة .
الموضوع : الكاتب الردود : المشاهدات : آخر رد
  DataGridViewCombobox AymanRamadanSaad 1 1,612 30-06-17, 07:22 AM
آخر رد: WAEL ABED

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


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