Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

VB statement testing 2 values to 1 result

Posted on 2013-01-04
2
Medium Priority
?
263 Views
Last Modified: 2013-01-04
Hello Experts,

Seemingly something that should be easy has been very difficult.
Basically I have two hidden fields on an .aspx page. In the code-behind I am trying to set the text of a label depending on the result of whether both items equal the same value.

When I try this below it doesn't work.

If HiddenField1.Value = 0 OR HiddenField2.Value = 0 Then
Label1.Text= ""
Else
Label1.Text = "Both values equal ZERO"

Open in new window


Is there another way to achieve this simply?

Thanks for considering this.
0
Comment
Question by:Phosphor
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 17

Accepted Solution

by:
nepaluz earned 2000 total points
ID: 38745642
Label1.Text = If(HiddenField1.Value = 0 AndAlso HiddenField2.Value = 0, "Both values equal ZERO", "")

Open in new window

0
 
LVL 1

Author Comment

by:Phosphor
ID: 38745695
Thank you. It didn't work at first but then I noticed the true/false were transposed.

Label1.Text = If(HiddenField1.Value = 0 AndAlso HiddenField2.Value = 0, "", "Both values equal ZERO")
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question