Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / December 2004

Tip: Looking for answers? Try searching our database.

MOD Operator

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Brian  Hammer - 05 Dec 2004 19:30 GMT
All - I once came across an example that used the mod in an if then...

What I need is to:

if i = 100 or i = 200 or i = 300 or .... then
   do my work
end if

i can be from 10 to 10,500, therefore the if would be long. How can I use
the mod to determine this by 100's? Or another way??

Thanks,
Brian
Jon Skeet [C# MVP] - 05 Dec 2004 20:13 GMT
> All - I once came across an example that used the mod in an if then...
>
[quoted text clipped - 6 lines]
> i can be from 10 to 10,500, therefore the if would be long. How can I use
> the mod to determine this by 100's? Or another way??

Not sure in what way this is related to Windows Forms - are you writing
in VB.NET? If so, I suggest you ask in the VB.NET group. (Effectively
you want if "i mod 100 = 0", but I don't know if that's exactly the
right syntax, not being a VB.NET programmer myself.)

Signature

Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Herfried K. Wagner [MVP] - 05 Dec 2004 21:04 GMT
"Jon Skeet [C# MVP]" <skeet@pobox.com> schrieb:
> Not sure in what way this is related to Windows Forms - are you writing
> in VB.NET? If so, I suggest you ask in the VB.NET group. (Effectively
> you want if "i mod 100 = 0", but I don't know if that's exactly the
> right syntax, not being a VB.NET programmer myself.)

Yep, that's the right syntax!

Signature

Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/

Brian  Hammer - 06 Dec 2004 01:44 GMT
Only casue I was working with a form and updating some labels and text
boxes.  :-)

Thanks for the code....

Brian

>> All - I once came across an example that used the mod in an if then...
>>
[quoted text clipped - 11 lines]
> you want if "i mod 100 = 0", but I don't know if that's exactly the
> right syntax, not being a VB.NET programmer myself.)
Lars Wittmann - 13 Dec 2004 06:44 GMT
If yourValue Mod 100 = 0 Then

  Debug.Write("Määäh")     ' Do stupid stuff for testing.

End If

if your value is 100, 200 .... 10000000 then it will happen what you want :)

if your value is 100,1482 ... the result of MOD will be 0,1482
if your value is 215,1482 ... the result of MOD will be 15,1482

Brian Hammer wrote:
> All - I once came across an example that used the mod in an if then...
>
[quoted text clipped - 9 lines]
> Thanks,
> Brian

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.