Private Sub dgvPROD_CellEndEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgvPROD.CellEndEdit
Select Case dgvPROD.CurrentCell.OwningColumn.Name
Case "upNAME"
dgvPROD.Item("sbPPNO", e.RowIndex).Value = dgvPROD.Item("upNAME", e.RowIndex).Value
dgvPROD.Item("ppNAME", e.RowIndex).Value = dgvPROD.Item("upNAME", e.RowIndex).FormattedValue
End Select
End Sub
Private Sub dgvPROD_EditingControlShowing1(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewEditingControlShowingEventArgs) Handles dgvPROD.EditingControlShowing
If dgvPROD.CurrentCell.OwningColumn.Name = "upNAME" Then
With CType(dgvPROD.CurrentCell, DataGridViewComboBoxCell)
.DataSource = ArrayComBox.ComBox2Item("Select ppNAME,ppNUMB From ProdPlace Where ppANSW='" &
dgvPROD.CurrentRow.Cells("sbPDNO").Value.ToString & "' Order by ppSORT")
.DisplayMember = "DisplayValue"
.ValueMember = "ValueData"
.InheritedStyle.BackColor = Color.Transparent
End With
End If
End Sub
優點:可動態隨row而異動cellvALUE
缺點:電腦太低階,會反應慢
沒有留言:
張貼留言