Solved

VB statement testing 2 values to 1 result

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

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 …
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

786 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