精通
英语
和
开源
,
擅长
开发
与
培训
,
胸怀四海
第一信赖
When add TimeTextBox on my project, I received the following error:当添加TimeTextBox到我的项目时,我收到以下错误:
System.IndexOutOfRangeException
What is this?这为什么?
first i'd like to thank the author for the great code. I'm not using it directly, but it gave me inspiration. So i'm glad to be able to give a little bit back. I found the following bug:
首先我要感谢作者的代码。我不直接使用它,但它给了我灵感。所以我很高兴能够给一点回来。我发现以下错误
The overridden OnSetComponentDefaults method in the Designer class is deprecated since .NET 2.0 and has no effect on the default values anymore.
OnSetComponentDefaults覆盖方法在设计器中类是弃用。NET 2.0,对默认值没有影响了
I have found no solution for this one. But since the default text values (like "textBox1") aren't suppressed anymore, there are issues in the Minute and Second properties in TimeBehavior:我没有找到解决方案。但由于默认文本值(如“textBox1”)不再压缩,在TimeBehavior的Minute和Second属性里有问题:
Change the get part of the改变的一部分:property from
Hide Copy Code
get
{
string text = m_textBox.Text;
int startPos = text.IndexOf(m_separator, m_hourStart) + 1;
if (startPos > 0 && text.Length >= startPos + 2)
return ToInt(text.Substring(startPos, 2));
return -1;
}
to this:
Hide Copy Code
get
{
string text = m_textBox.Text;
if (m_hourStart < text.Length)
{
int startPos = text.IndexOf(m_separator, m_hourStart) + 1;
if (startPos > 0 && text.Length >= startPos + 2)
return ToInt(text.Substring(startPos, 2));
}
return -1;
}
and the get part of the和得到的一部分:
property from
Hide Copy Code
get
{
string text = m_textBox.Text;
int startPos = text.IndexOf(m_separator, m_hourStart);
if (startPos > 0)
{
startPos = text.IndexOf(m_separator, startPos + 1) + 1;
if (startPos == 0)
return -1;
}
if (text.Length >= startPos + 2 && Char.IsDigit(text[startPos]) && Char.IsDigit(text[startPos + 1]))
return ToInt(text.Substring(startPos, 2));
return -1;
}
to this:
Hide Copy Code
get
{
string text = m_textBox.Text;
if (m_hourStart < text.Length)
{
int startPos = text.IndexOf(m_separator, m_hourStart);
if (startPos > 0)
{
startPos = text.IndexOf(m_separator, startPos + 1) + 1;
if (startPos == 0)
return -1;
if (text.Length >= startPos + 2 && Char.IsDigit(text[startPos]) && Char.IsDigit(text[startPos + 1]))
return ToInt(text.Substring(startPos, 2));
}
}
return -1;
}
This should fix it. I hope this will help.这应该能够解决问题了。我希望能帮到你。
Thanks for your solution, I have got the same problem when with TimeTextBox, now I can work fine in VS2005. 谢谢你的解决方案,当使用TimeTextBox我有同样的问题,,现在我可以在VS2005工作了、