Unwanted error

Trips

Well-known member
Joined
Aug 7, 2010
Messages
2,788
Hello. I have a textbox that keeps track of song time for the currently selected song. Its in the textbox_leave event so that when you enter current time in the text box for the selected song and you select another one, it keeps track of the time inputed
for the previous song. The text box is located under the songs tab where the song titles are. The problem is when I select the Songs tab and then select any other tab without inputing anything into it, it will bring up a message box with the error
that is only supposed to occur if the wrong text is inputed into the text box. However if youre just selecting tabs to see whats there the error shouldnt occur. Any help with this would be greatly appreciated,
Heres the code thats giving me problems:
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; private <span style="color:Blue; void txtTrackLength_Leave(<span style="color:Blue; object sender, EventArgs e)
{
<span style="color:Blue; string text = txtTrackLength.Text;

<span style="color:Blue; if (text.Length != 4 || !<span style="color:Blue; char.IsNumber(text[0]) ||
!<span style="color:Blue; char.IsNumber(text[1]) || !<span style="color:Blue; char.IsNumber(text[2]) ||
!<span style="color:Blue; char.IsNumber(text[3]))

{
MessageBox.Show(<span style="color:#A31515; "Please input time as format: mmss");
<span style="color:Blue; return;
}
[/code]
-PCRider

View the full article
 
Back
Top