VB.NET 中的日期时间错误
单击 datagridview 行时尝试将数据检索到日期时间选择器控件时,出现以下错误。
Dim i as byte
i = tblView.CurrentRow.Index
txtEnterDate.Text = tblView.Item(2, i).Value
txtPubYear.Text = tblView.Item(3, i).Value
该字符串未被识别为有效的日期时间。从索引 0 开始有一个未知单词。
如何修复此问题?
I got the following error when trying to retrieve the data to the datetime picker control when clicking on the datagridview row.
Dim i as byte
i = tblView.CurrentRow.Index
txtEnterDate.Text = tblView.Item(2, i).Value
txtPubYear.Text = tblView.Item(3, i).Value
The string was not recognized as a valid DateTime. There is an unknown word starting at index 0.
How can this be fixed?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
听起来好像涉及一个 DateTimePicker,并且
Item(2,i)
中已经有一个经过验证的日期,试试这个:
It sounds as through there's a DateTimePicker involved, and there's a validated date already in
Item(2,i)
Try this:
您收到的错误表明 tblView Item 集合包含无效数据。如果没有看到更多代码,很难判断发生了什么。我建议在有问题的行上设置一个断点,并使用“立即”窗口来确定数组集合为何为空。
The error you are getting suggests that the tblView Item collection has invalid data. Without seeing more code, its hard to tell what's going on. I would suggest setting a breakpoint on the offending line and using the Immediate window to determine why your array collection is empty.