Solved

VB statement testing 2 values to 1 result

Posted on 2013-01-04
2
260 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 500 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

739 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