Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > if else on type of interger

Reply
Thread Tools

if else on type of interger

 
 
Simon
Guest
Posts: n/a
 
      10-22-2004
Hi there

I know I should be able to do this, but I'm stuck!

I am trying to build a table that forms from cats being pulled from a DB.

The table will be 3 cols by x rows.

I have been doing an if else based on if int(Ident/3)= 1, 2, 3, 4 etc etc ,
but this is sloppy!

What I need to get working is

<%

Code Snipped

if int(Ident/3)= [a whole number] then

%>
formatting A is done
<% else %>
formatting b is done
<%
end if

Code Snipped

%>

Thanks in advance

Si


 
Reply With Quote
 
 
 
 
Ray Costanzo [MVP]
Guest
Posts: n/a
 
      10-22-2004
Perhaps you are looking for the mod[ulus] operator, although it wouldn't be
much different from what you're doing now. What exactly isn't working for
you in the way you want it to?

If Ident Mod 3 Then
'formatting a
Else
'formatting b
End If

http://msdn.microsoft.com/library/en...l/vsoprmod.asp

Ray at work





"Simon" <(E-Mail Removed)> wrote in message
news:rs6ed.133939$(E-Mail Removed) .uk...
> Hi there
>
> I know I should be able to do this, but I'm stuck!
>
> I am trying to build a table that forms from cats being pulled from a DB.
>
> The table will be 3 cols by x rows.
>
> I have been doing an if else based on if int(Ident/3)= 1, 2, 3, 4 etc etc
> ,
> but this is sloppy!
>
> What I need to get working is
>
> <%
>
> Code Snipped
>
> if int(Ident/3)= [a whole number] then
>
> %>
> formatting A is done
> <% else %>
> formatting b is done
> <%
> end if
>
> Code Snipped
>
> %>
>
> Thanks in advance
>
> Si
>
>



 
Reply With Quote
 
 
 
 
Dave Anderson
Guest
Posts: n/a
 
      10-22-2004
Ray Costanzo [MVP] wrote:
> If Ident Mod 3 Then
> 'formatting a
> Else
> 'formatting b
> End If


That ought to be:

If Ident Mod 3 = 0 Then
^^^^^


--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.


 
Reply With Quote
 
Ray Costanzo [MVP]
Guest
Posts: n/a
 
      10-22-2004
Oh yeah. Thanks. :]

Ray at work

"Dave Anderson" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Ray Costanzo [MVP] wrote:
>> If Ident Mod 3 Then
>> 'formatting a
>> Else
>> 'formatting b
>> End If

>
> That ought to be:
>
> If Ident Mod 3 = 0 Then
> ^^^^^
>
>
> --
> Dave Anderson
>
> Unsolicited commercial email will be read at a cost of $500 per message.
> Use
> of this email address implies consent to these terms. Please do not
> contact
> me directly or ask me to contact you directly for assistance. If your
> question is worth asking, it's worth posting.
>
>



 
Reply With Quote
 
Simon
Guest
Posts: n/a
 
      10-22-2004
Excellent, Thanks for that.

I worked around it by doing

if int(Ident/cellCount) - Ident/cellCount = 0 then

which worked, but .... now

RowBreak = Ident Mod cellCount

if RowBreak = 0 then

Works and is a lot cleaner

Thanks again.

Si




 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting 64-bit interger to character Tim Slattery C++ 2 01-06-2007 02:32 AM
How to represent interger powers in C++? heng C++ 3 12-06-2006 03:23 AM
std_logic_vector ==> interger? uvbaz VHDL 6 09-12-2006 08:13 AM
Any easy to printf an interger in 9,999, 99 format? I_have_nothing C Programming 4 05-13-2005 08:55 AM
Cannot be converted to 'Interger' =?Utf-8?B?VGltOjouLg==?= ASP .Net 2 11-03-2004 02:32 PM



Advertisments