和不能得到xcmbTS
和y作为文本cmbTA
datagridview1.item(4,i)
anddatagridview1.item(5,i)
是日期类型。我想将其转换为字符串,以便可以将其combobox
作为文本放在我的位置上。我combobox
的是cmbTS
和cmbTA
。
Private Sub DataGridView1_CellClick(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView1.CellClick
btnEdit.Visible = True
Dim i As Integer
i = DataGridView1.CurrentRow.Index
Dim x As String = CStr(DataGridView1.Item(4, i).Value.ToString)
Dim y As String = CStr(DataGridView1.Item(5, i).Value.ToString)
MsgBox(x)
MsgBox(y)
txtTrainID.Text = DataGridView1.Item(0, i).Value
txtRouteID.Text = DataGridView1.Item(1, i).Value
txtLine.Text = DataGridView1.Item(2, i).Value
cmbLine1.Text = DataGridView1.Item(3, i).Value
cmbLine2.Text = DataGridView1.Item(3, i).Value
cmbLine3.Text = DataGridView1.Item(3, i).Value
cmbTS.Text = x
cmbTA.Text = y
txtTrainName.Text = DataGridView1.Item(6, i).Value
cmbFlag.Text = DataGridView1.Item(7, i).Value
End Sub