나는 프로그래밍의 초보자 일 뿐이며, 함수 하나를 만들었는데, 어리석은 한 가지 문제와 아주 어리석은 질문. 무례하지 말아라. 어떻게 다른 폼이나 클래스에서이 함수를 호출 할까? 또는 편집 같은 형태이 메서드를 호출하는 방법?
public void dataGridView1_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e)
{
for (int i = 0; i <= dtInfo.Rows.Count - 2;i++)
{
Battery = Convert.ToDateTime(dtInfo.Rows[i].Cells[5].Value.ToString());
Oil = Convert.ToDateTime(dtInfo.Rows[i].Cells[14].Value.ToString());
Fran = Convert.ToDateTime(dtInfo.Rows[i].Cells[12].Value.ToString());
lastkm = int.Parse(dtInfo.Rows[i].Cells[13].Value.ToString());
batt = Battery - DateTime.Now;
doil = Oil - DateTime.Now;
dfran = Fran - DateTime.Now;
if (batt.Days <= 7)
{
dtInfo.Rows[i].Cells[5].Style.BackColor = Color.Green;
}
if (doil.Days <= 7)
{
dtInfo.Rows[i].Cells[14].Style.BackColor = Color.Green;
}
if (dfran.Days <= 7)
{
dtInfo.Rows[i].Cells[12].Style.BackColor = Color.Green;
}
if (lastkm <= 500)
{
dtInfo.Rows[i].Cells[13].Style.BackColor = Color.Green;
}
}
}
에
내가 처음 내 양식을 열
색상 변화는 내가 그것을 이 변경 실 거예요 다시 열 때하지만 때 내가 코드에게의 값을 추적 색상 변화가 아니라 이벤트 핸들러의 셀
이 참고로, 귀하의 질문에 당신은 모든 방법을 게시 할 필요가 없습니다 그러나 당신은 당신이 단지 할 수있는 몇 가지 이유를 호출해야하는 경우
, DataGridViewBindingCompleteEventArgs e)') –