|
-
Feb 1st, 2003, 11:48 PM
#1
Thread Starter
Frenzied Member
Variable not holding value?
Why do dots always print when the bool value should be set to true after one dot?
Code:
private void do3()
{
if(TorF(TB1.Text))
RTB2.Text=TB1.Text;
}
bool check2=false;
public bool TorF(string str)
{
char[] chr = str.ToCharArray();
foreach (char dummy in chr)
{
if (char.IsDigit(dummy)) return true;
else if (dummy=='.'&& check2==false) {check2=true; return true;}
}
return false;
}
-
Feb 2nd, 2003, 12:09 AM
#2
PowerPoster
What are you trying to do? with the method?
-
Feb 2nd, 2003, 12:20 AM
#3
Thread Starter
Frenzied Member
I am just practicing right now.
This should not execute if check2 is true:
else if (dummy=='.' && check2==false) {check2=true; return true;}
But for some reason the dots always print. I only want one dot to print and I can't figure out why that does not work right.
-
Feb 7th, 2003, 09:35 PM
#4
Hyperactive Member
Can you show us the input to the method?
I think your logic might be off a little bit.
-scott
he he he
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|