Select Case e.DataCol.name Case "数量" Dim dxs As DataRow = e.DataRow Dim dis As DataRow dis = DataTables("库存明细").Find("采购编号 = '" & dxs("采购编号") & "' and 产品名称 = '" & dxs("产品名称") & "'") If dis("库存数量")<dxs("数量") Then MessageBox.Show("该价格的产品库存不足,") e.cancel = True End If End Select