그리드가 6 개 있습니다 (항목 이름, 최소 수량, 최대 수량, 최대 amout, 최대 금액, 할인).데스크톱 응용 프로그램 gridview 셀 값은 셀 값에 따라 번갈아 가며 잠 깁니다.
요구 사항
내가 분 수량을 선택하면이 최대 수량 열이 해제됩니다 그리고 내가 분 금액, 최대이 해제됩니다 amout 열 그 반대를 선택하면 그 값이 제로가된다. 수량에 최소값을 입력하면 그리드의 행에는 첫 번째 행의 최대 값이 포함됩니다.
그리드가 6 개 있습니다 (항목 이름, 최소 수량, 최대 수량, 최대 amout, 최대 금액, 할인).데스크톱 응용 프로그램 gridview 셀 값은 셀 값에 따라 번갈아 가며 잠 깁니다.
요구 사항
내가 분 수량을 선택하면이 최대 수량 열이 해제됩니다 그리고 내가 분 금액, 최대이 해제됩니다 amout 열 그 반대를 선택하면 그 값이 제로가된다. 수량에 최소값을 입력하면 그리드의 행에는 첫 번째 행의 최대 값이 포함됩니다.
/* You can use grid's cell validating event.
ColMinimumQuantity, ColMaximumQuantity, ColMinimumAmount, ColMaximumAmount are grid's column name
you can set them in Grid Properties. */
private void dataGridView1_CellValidating(object sender, DataGridViewCellValidatingEventArgs e)
{
if (dataGridView1.CurrentCell.OwningColumn.Name.ToUpper().ToString() == "ColMaximumQuantity")
{
dataGridView1.CurrentRow.Cells["ColMinimumQuantity"].Value = "0";
dataGridView1.CurrentRow.Cells["ColMaximummQuantity"].ReadOnly = false;
dataGridView1.CurrentRow.Cells["ColMinimummQuantity"].ReadOnly = true;
}
if (dataGridView1.CurrentCell.OwningColumn.Name.ToUpper().ToString() == "ColMaximumAmount")
{
dataGridView1.CurrentRow.Cells["ColMinimumAmount"].Value = "0";
dataGridView1.CurrentRow.Cells["ColMaximummQuantity"].ReadOnly = false;
dataGridView1.CurrentRow.Cells["ColMinimummQuantity"].ReadOnly = true;
}
if (dataGridView1.CurrentCell.OwningColumn.Name.ToUpper().ToString() == "ColMinimumAmount")
{
dataGridView1.CurrentRow.Cells["ColMaximumAmount"].Value = "0";
dataGridView1.CurrentRow.Cells["ColMiniimumAmount"].ReadOnly = false;
dataGridView1.CurrentRow.Cells["ColMaximumAmount"].ReadOnly = true;
}
}
Welcome to stackoverflow! 게시물의 정확성을 높이기 위해 샘플 코드에 대한 간단한 설명을 제공하는 것이 더 좋습니다. –
그리드의 셀 유효성 검사 이벤트를 사용할 수 있습니다.
ColMinimumQuantity, ColMaximumQuantity, ColMinimumAmount, ColMaximumAmount는 그리드의 열 이름 이며 그리드 속성에서 설정할 수 있습니다.
내 질문을 이해하면 대답 해주세요. p/z – minu
그리고 무엇을 시도 했습니까? –
나는 와트를 이해하지 못한다. – minu