Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I'm sure there has to be a simple way of doing this but I have spent hours pouring over web pages and books but can't get started in the right direction!

 

What I would like to do is evaluate a text box to determine if there is an even number of characters. I thought I could do use something like this;

 

IEEERemainder(txtField.Length, 2)

 

If the returned value was greater than 0 then apparently there would not be an even number of characters.

 

However the results were rather unpredictable.

 

Any suggestions would be greatly appreciated.

Tate

Posted

do you mean by even that it is dividable by 2? (english is not my native language)

 

if yes then use this

 

if (txtField.Length % 2)

// code for even

else

// code for not even

 

 

if i understood you wrong, then please tell me :)

Posted

I'm not aware of any such syntax. What does the "%" character do? I can't find any reference to it in the Visual Studio help index.

 

 

Thanks for the reply.

Posted

Appears the Mod function returns the same thing as the IEEERemainder function.

 

Either will work fine now that I understand them better. Thanks for everyone's input.

 

 

Tate

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...