本文介绍了如何在VB.NET中以HH:mm:ss:fff格式减去两个不同的时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
公共类Form1
私有 Sub Button1_Click(ByVal sender As System.Object,ByVal e As System.EventArgs)处理Button1.Click
TextBox1.Text =格式(现在, HH:mm:ss:fff)'开始按钮
结束 Sub
私人 Sub Button2_Click(ByVal sender As System.Object,ByVal e As System.EventArgs)处理Button2.Click
TextBox2.Text =格式(现在, HH:mm:ss:fff)'结束按钮
结束 Sub
Private Sub Button3_Click(ByVal sender As System.Object,ByVal e As System.EventArgs)Handles Button3.Click
'减法按钮
TextBox3 .Text = TextBox2.Text - TextBox1.Text
结束 Sub
End Class
以上代码出现以下错误。
从字符串12:00:03:554转换为Double无效。
解决方案
Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click TextBox1.Text = Format(Now, "HH:mm:ss:fff") ' start button End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click TextBox2.Text = Format(Now, "HH:mm:ss:fff") ' end button End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click 'subtract button TextBox3.Text = TextBox2.Text - TextBox1.Text End Sub End Class
for the above code the following error is coming.
Conversion from string "12:00:03:554" to type 'Double' is not valid.
解决方案
这篇关于如何在VB.NET中以HH:mm:ss:fff格式减去两个不同的时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!