TimeSpan.Parse导致00:00:00,为什么? [英] TimeSpan.Parse resulting in 00:00:00, why?
本文介绍了TimeSpan.Parse导致00:00:00,为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用timepan'的Parse方法从
字符串构建我的时间跨度。这是'我使用的线:
m_Delay.Parse(RegKey.GetValue(延迟,01:00:00))
我从RegKey得到的值是00:00:30,所以它应该给出一个时间间隔为
30秒,但是当我做msgbox(m_Delay.ToString)时,它显示00:00:00。
我做错了什么?
谢谢
Hi,
I''m using the timespan''s Parse method to build my timespan from a
string. here''s the line I use :
m_Delay.Parse(RegKey.GetValue("Delay", "01:00:00"))
the value I get from the RegKey is 00:00:30, so it should give a timespan of
30 seconds, but when I do msgbox(m_Delay.ToString), it displays 00:00:00.
Am I doing something wrong?
thanks
推荐答案
ThunderMusic,
| m_Delay.Parse(RegKey.GetValue(" Delay"," 01:00:00"))
TimeSpan.Parse是一个返回新TimeSpan值的共享方法。 br />
TimeSpan本身是不可变的(不会改变)。
尝试类似:
m_Delay = TimeSpan.Parse(RegKey.GetValue(Delay,01:00:00))
希望这会有所帮助
Jay
" ThunderMusic" < NO ******* @ sympatico.caSPAMATALL>在消息中写道
新闻:OY ************* @ TK2MSFTNGP15.phx.gbl ...
|
|我正在使用时间跨度的Parse方法从
|构建我的时间跨度串。这是'我使用的线:
|
| m_Delay.Parse(RegKey.GetValue(" Delay"," 01:00:00"))
|
|我从RegKey获得的价值是00:00:30,所以它应该给出一个时间跨度
| 30秒,但是当我做msgbox(m_Delay.ToString)时,它显示00:00:00。
|我做错了吗?
|
|谢谢
|
|
ThunderMusic,
| m_Delay.Parse(RegKey.GetValue("Delay", "01:00:00"))
TimeSpan.Parse is a shared method that returns a new TimeSpan value.
TimeSpan itself is immutable (doesn''t change).
Try something like:
m_Delay = TimeSpan.Parse(RegKey.GetValue("Delay", "01:00:00"))
Hope this helps
Jay
"ThunderMusic" <NO*******@sympatico.caSPAMATALL> wrote in message
news:OY*************@TK2MSFTNGP15.phx.gbl...
| Hi,
| I''m using the timespan''s Parse method to build my timespan from a
| string. here''s the line I use :
|
| m_Delay.Parse(RegKey.GetValue("Delay", "01:00:00"))
|
| the value I get from the RegKey is 00:00:30, so it should give a timespan
of
| 30 seconds, but when I do msgbox(m_Delay.ToString), it displays 00:00:00.
| Am I doing something wrong?
|
| thanks
|
|
我也找到了它。我没有看到方法被共享(静态),所以我juste
必须执行以下操作:
m_Delay = TimeSpan.Parse(RegKey.GetValue (延迟,01:00:00))
现在它工作正常。
ThunderMusic < NO ******* @ sympatico.caSPAMATALL>一个écritdansle message de
新闻:OY ************* @ TK2MSFTNGP15.phx.gbl ...
I found it too. I had not seen the method was shared (static), so I juste
had to do the following :
m_Delay = TimeSpan.Parse(RegKey.GetValue("Delay", "01:00:00"))
Now it works fine.
"ThunderMusic" <NO*******@sympatico.caSPAMATALL> a écrit dans le message de
news:OY*************@TK2MSFTNGP15.phx.gbl...
<我正在使用timepan'的Parse方法从
字符串构建我的时间跨度。这是我使用的行:
m_Delay.Parse(RegKey.GetValue(延迟,01:00:00))
值我从RegKey获得的是00:00:30,所以它应该给30秒的时间
,但是当我做msgbox(m_Delay.ToString)时,它显示00:00:00。
Am我做错了什么?
感谢
Hi,
I''m using the timespan''s Parse method to build my timespan from a
string. here''s the line I use :
m_Delay.Parse(RegKey.GetValue("Delay", "01:00:00"))
the value I get from the RegKey is 00:00:30, so it should give a timespan of 30 seconds, but when I do msgbox(m_Delay.ToString), it displays 00:00:00.
Am I doing something wrong?
thanks
哦,我发布之前没有看到你的回答...非常感谢
回答。
Jay B. Harlow [MVP - Outlook]" < JA ************ @ msn.com> aécritdansle
message de news:eG ************* @ TK2MSFTNGP12.phx.gbl ...
oh, I didn''t see your answer before posting mine... thanks a lot for
answering.
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> a écrit dans le
message de news:eG*************@TK2MSFTNGP12.phx.gbl...
ThunderMusic,
| m_Delay.Parse(RegKey.GetValue(" Delay"," 01:00:00"))
TimeSpan.Parse是一个返回新TimeSpan值的共享方法。
<时间跨度本身是不可变的(不会改变)。
尝试类似的事情:
m_Delay = TimeSpan.Parse(RegKey.GetValue(" Delay", 01:00:00))
希望这会有所帮助
Jay
ThunderMusic < NO ******* @ sympatico.caSPAMATALL>在消息中写道
新闻:OY ************* @ TK2MSFTNGP15.phx.gbl ...
|
|我正在使用时间跨度的Parse方法来构建我的时间跨度
|串。这是我使用的线:
|
| m_Delay.Parse(RegKey.GetValue(" Delay"," 01:00:00"))
|
|我从RegKey获得的价值是00:00:30,所以它应该给
的时间长度
| 30秒,但是当我做msgbox(m_Delay.ToString)时,它显示
00:00:00。 |我做错了吗?
|
|谢谢
|
|
ThunderMusic,
| m_Delay.Parse(RegKey.GetValue("Delay", "01:00:00"))
TimeSpan.Parse is a shared method that returns a new TimeSpan value.
TimeSpan itself is immutable (doesn''t change).
Try something like:
m_Delay = TimeSpan.Parse(RegKey.GetValue("Delay", "01:00:00"))
Hope this helps
Jay
"ThunderMusic" <NO*******@sympatico.caSPAMATALL> wrote in message
news:OY*************@TK2MSFTNGP15.phx.gbl...
| Hi,
| I''m using the timespan''s Parse method to build my timespan from a
| string. here''s the line I use :
|
| m_Delay.Parse(RegKey.GetValue("Delay", "01:00:00"))
|
| the value I get from the RegKey is 00:00:30, so it should give a timespan of
| 30 seconds, but when I do msgbox(m_Delay.ToString), it displays 00:00:00. | Am I doing something wrong?
|
| thanks
|
|
这篇关于TimeSpan.Parse导致00:00:00,为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文