我有一个DataGridView(dataGridViewYoungLearnersEggrafes),4个文本框(txtboxSlot,txtboxDurationExam,txtboxBreakFrom,txtboxBreakTo)和1个toolstriptextbox(TimeSpeakingToolStripMenuItem。我在txtboxSlot,在txtboxDurationExam的整数实施例20,在txtboxBreakFrom时间把一个整数例3 ex.12:50和txtboxBreak的时间从13:05开始。之后我从网格中选择所有行,然后在TimeSpeakingToolStripMenuItem(文本框)中加时间。 当我按下回车键时,我想将TimeSpeakingToolStripMenuItem的值放到网格的前3行,接下来的3行将采用相同的值+ txtboxDurationExam等,当行要在txtboxBreakFrom和txtboxBreak之间取值时它会把txtboxBreakTo放到那3行,它会像以前一样继续。到目前为止,我已经编写了下面的代码,它所做的是给出TimeSpeakingToolStripMenuItem的值,下一行取值+ txtboxDurationExam。 有人可以帮帮我吗? 我会感激任何帮助。
private void toolStripTextBoxoraSpeaking_KeyUp(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
if (toolStripTextBoxoraSpeaking.Text != "")
{
TimeSpan timeSpeaking = TimeSpan.Parse(toolStripTextBoxoraSpeaking.Text);
int DurationExam = Convert.ToInt32(txtboxDiarkeiaExetasis.Text.ToString());
int slot = Convert.ToInt32(txtboxSlot.Text.ToString());
TimeSpan DialimaApo = TimeSpan.Parse(txtboxDialimaApo.Text);
TimeSpan DialimaEos = TimeSpan.Parse(txtboxDialimaEos.Text);
TimeSpan duration = new TimeSpan(0, 0, DurationExam, 0);
Int32 selectedRowCount = dataGridViewYoungLearnersEggrafes.Rows.GetRowCount(DataGridViewElementStates.Selected);
if (selectedRowCount > 0)
{
for (int i = 0; i < selectedRowCount; i++)
{
dataGridViewYoungLearnersEggrafes.SelectedRows[i].Cells["timeSpeakingDataGridViewTextBoxColumn"].Value = timeSpeaking;//Value.ToString("yyyy-MM-dd")
timeSpeaking += duration;
}
}
BSProgrammaExetaseonYoungLearnersEggrafes.EndEdit();
programmaExetaseonYoung_Learners_Starters_MoversFlyersEggrafesTableAdapter.Connection = MyConn;
programmaExetaseonYoung_Learners_Starters_MoversFlyersEggrafesTableAdapter.Update(DSPerioxes_EidoiEksetaseonNew.ProgrammaExetaseonYoung_Learners_Starters_MoversFlyersEggrafes);
toolStripTextBoxoraSpeaking.Clear();
MessageBox.Show("Οι εγγραφές που επιλέξατε ενημερώθηκαν!", "Ενημέρωση!");
}
else
{
MessageBox.Show("Παρακαλώ πληκτρολογήστε Ώρα Speaking!", "Ενημέρωση!");
}
}
}