에 결합 저도 같은 이벤트 (확인)를 여러 번, 즉를 포함 할 수있는 로그 파일을 가지고 5시 42분 : 34
검증 종료 : 7시 12분 52초동적 컨트롤을 생성하고 데이터 세트
검증 결과 :
검증 시작 : 12시 38분 1초
검증 종료 : 14시 5분 12초
이 정보를 사용자에게 표시하는 컨트롤 (레이블 및 TextBox 또는 DateTimePicker)을 동적으로 만들었습니다.
UID | ID | Start | End
1 | 001 | 05:42:34 | 07:12:52
2 | 001 | 12:38:01 | 14:05:12
Codewise : 내가 알고 싶은 것은 데이터베이스에 기록 할 때 그 방식으로 내 데이터 세트에 이러한 컨트롤을 바인딩하는 방법이며, 각각의 검증은 동일한 ID와 연관된 새로운 행, 즉는 내가 포인트 체크리스트 박스에 표시되는 로그 디렉토리를 프로그램하십시오. selectedIndex의 변화에, 나는 아래 전화 :
void ParseImagerLogs(string source)
{
int i = 0;
//Log fields are parsed to a key/value pair
if (key.Equals("LogID"))
{
logIdTextBox.Text = value
}
if (key.Equals("VerStarted"))
{
//Date format ddd MMM dd HH:mm:ss yyyy is parsed to a useable format and
//saved as timeStart
verStartedDateTimePicker.Value = verTimeStart;
}
if (key.Equals("VerEnded"))
{
//Same parsing technique
verEndedDateTimePicker.Value = verTimeEnd;
//Work out the elapsed time
verTime - timeEnd.Subtract(timeStart).ToString();
//Pass the fields to a new method which dynamically generates the
GenerateVerificationFields(i, verStartedDateTimePicker.Value, verEndeDateTimePicker.Value, verTime.TextBox
//I have my first verification instance, so i++ and look for the next one.
i++;
}
}
private void GenerateVerificationFields(int amount, DateTime verStartval, DateTime verEndval, string verTimeval)
{
int i = amount;
int j = i + 1;
//Create groupBox
GroupBox groupBox = new GroupBox();
groupBox.Name = "verGroup" + i.ToString();
groupBox.Width = 430;
groupBox.Height = 120;
groupBox.Left = 5;
groupBox.Top = 42 + (groupBox.Height * i) + (10 * i);
groupBox.Text = "Verification #" + j.ToString();
//Create VerStart
DateTimePicker verStart = new DateTimePicker();
verStart.Name = "verStart" + i.ToString();
verStart.Width = 224;
verStart.Height = 22;
verStart.Location = new Point(160, 25);
verStart.DataBindings.Add(new Binding("Value", acqreports_testDataSet, "verification.VerStarted"));
verStart.Value = verStartval;
//Create VerEnded
DateTimePicker verEnd = new DateTimePicker();
verEnd.Name = "verStart" + i.ToString();
verEnd.Width = 224;
verEnd.Height = 22;
verEnd.Location = new Point(160, 55);
verEnd.DataBindings.Add(new Binding("Value", acqreports_testDataSet, "verification.VerEnded"));
verEnd.Value = verEndval;
//Create VerTime
TextBox verTime = new TextBox();
verTime.Name = "verTime" + i.ToString();
verTime.Width = 224;
verTime.Height = 22;
verTime.Location = new Point(160, 85);
verTime.Text = verTimeval;
//Create Ver Start label
Label lblVerStart = new Label();
lblVerStart.Name = lblVerStart + i.ToString();
lblVerStart.Text = "Ver Started: ";
lblVerStart.Location = new Point(5, 25);
//Create Ver End label
Label lblVerEnd = new Label();
lblVerEnd.Name = lblVerEnd + i.ToString();
lblVerEnd.Text = "Ver Ended: ";
lblVerEnd.Location = new Point(5, 55);
//Create Ver Time label
Label lblVerTime = new Label();
lblVerTime.Name = lblVerTime + i.ToString();
lblVerTime.Text = "Ver Time: ";
lblVerTime.Location = new Point(5, 85);
//Add created controls to groupBox
groupBox.Controls.Add(verStart);
groupBox.Controls.Add(verEnd);
groupBox.Controls.Add(verTime);
groupBox.Controls.Add(lblVerStart);
groupBox.Controls.Add(lblVerEnd);
groupBox.Controls.Add(lblVerTime);
tabControl2.TabPages[2].Controls.Add(groupBox);
}
내가 다음 각 검증 이벤트와 테이블을 업데이트 할 DateTimePickers 및 VerTime.Text을 사용하고 싶습니다.
몇 가지 아이디어가 있지만 좀 더 자세한 정보가 필요합니다. 일부 코드는 도움이 될 것입니다. – Luke