输入的字符串格式不正确 [英] input strings are not in a correct format exception
本文介绍了输入的字符串格式不正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
If reader("Time").ToString <> "" And reader("DeviceId").ToString() <> "" Then
myarrlst11_1.Add(reader("sno").ToString) 'sno
data_time = reader("Time").ToString.Split(":")
myarrlst13_1.Add(reader("DeviceId").ToString) 'Device id
myarrlst21_1.Add(data_time(0))
myarrlst22_1.Add(data_time(1))
myarrlst23_1.Add(data_time(2))
Try
time1 = Convert.ToInt32(data_time(0) & data_time(1) & data_time(2))
'THIS IS THE LINE WHERE IT IS SHOWING AS INPUT STRING NOT IN A CORRECT FORMAT
Catch ex As Exception
End Try
myarlst_tm_1.Add(time1)
推荐答案
变量time1的类型是什么.您正在尝试为time1分配一个整数类型值.请检查
Hi,
Whats the type of the variable time1. you are trying to assign an integer type value to time1. Please check the value of
data_time(0) & data_time(1) & data_time(2)
,然后将其转换为整数.
问候
塞巴斯蒂安
before casting it to integer.
Regards
Sebastian
这篇关于输入的字符串格式不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文