-1
我有一個屏幕包含兩個按鈕和一個6列的數據網格。當按下按鈕1時,它顯示第1到第4列的行中的數據。當我按下按鈕2時,我希望我的應用程序填充行中的其餘列(即第5列和第6列)。通過單擊按鈕完成行的第二部分?
解決方案可能很明顯,但我不知道如何解決它。
編輯:對不起,我忘記提到之前,當我點擊第二個按鈕,數據出現在正確的位置,即在最後兩列。除了它不在同一行。數據出現一行。
這裏是我的代碼:
Private Sub btnClockIn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClockIn.Click
Homescreen.DataGridViewEmployee.ColumnCount = 6
Homescreen.DataGridViewEmployee.Columns(0).Name = "Employee Number"
Homescreen.DataGridViewEmployee.Columns(1).Name = "Day"
Homescreen.DataGridViewEmployee.Columns(2).Name = "Week Number"
Homescreen.DataGridViewEmployee.Columns(3).Name = "Time In"
Homescreen.DataGridViewEmployee.Columns(4).Name = "Time Out"
Homescreen.DataGridViewEmployee.Columns(5).Name = "Hours"
Dim row As String() = New String() {ENumber, day, WeekNum, StartTime, "", ""}
Homescreen.DataGridViewEmployee.Rows.Add(row)
Homescreen.DataGridViewEmployee.ReadOnly = True
Private Sub btnClockOut_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClockOut.Click
Homescreen.DataGridViewEmployee.ColumnCount = 6
Homescreen.DataGridViewEmployee.Columns(0).Name = "Employee Number"
Homescreen.DataGridViewEmployee.Columns(1).Name = "Day"
Homescreen.DataGridViewEmployee.Columns(2).Name = "Week Number"
Homescreen.DataGridViewEmployee.Columns(3).Name = "Time In"
Homescreen.DataGridViewEmployee.Columns(4).Name = "Time Out"
Homescreen.DataGridViewEmployee.Columns(5).Name = "Hours"
Dim row As String() = New String() {"", "", "", "", EndTime, Diff}
Homescreen.DataGridViewEmployee.Rows.Add(row)
Homescreen.DataGridViewEmployee.ReadOnly = True