31-10-22, 05:47 PM
وعليكم السلام
كود :
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim MyDataGridViewButton As New System.Windows.Forms.DataGridViewButtonColumn
Me.DataGridView1.Columns.Add(MyDataGridViewButton)
MyDataGridViewButton.DisplayIndex = Me.DataGridView1.Columns.Count
MyDataGridViewButton.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells
Dim DataGridViewCellStyle2 As New System.Windows.Forms.DataGridViewCellStyle With {
.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter,
.NullValue = "..."
}
MyDataGridViewButton.DefaultCellStyle = DataGridViewCellStyle2
MyDataGridViewButton.HeaderText = "عرض موجود"
MyDataGridViewButton.Resizable = System.Windows.Forms.DataGridViewTriState.[False]
AddHandler Me.DataGridView1.CellClick, Sub(oSender As Object, Args As DataGridViewCellEventArgs)
If Args.ColumnIndex = MyDataGridViewButton.Index Then
Dim Dgvr = Me.DataGridView1.Rows(Args.RowIndex)
labell.Text = Dgvr.Cells(1).Value
label_product.Text = Dgvr.Cells(2).Value
UNIT.Text = Dgvr.Cells(3).Value
DateTimePicker1.Text = Dgvr.Cells(4).Value
Qty.Text = Dgvr.Cells(5).Value
TKLFA.Text = Dgvr.Cells(6).Value
Price.Text = Dgvr.Cells(7).Value
End If
End Sub
End Sub