?
Solved

lable text syntax

Posted on 2006-06-21
2
Medium Priority
?
191 Views
Last Modified: 2010-04-23
I have a lable (lblPathway) I wanted added to an existing windows form.

I want the lable to read what is pulled over by a dataadapter.

I've created a dataset from this adapter (dsPathway) and it contains two fields

fieldA, fieldB


If fieldA = 1(it's a bit 1 or 0) then I want it to display some text and a FieldB. else I want to display only fieldB.


so  something like   If dsPathway.fieldA = '1' then  lblPathway = "IMG + dspathway.fieldb.text"  Else lblPathway = DsPathway.text

so does this look correct?  do I need a function?

Thanks in advance.

Is this syntax correct?



0
Comment
Question by:TimSweet220
[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
2 Comments
 
LVL 20

Expert Comment

by:ElrondCT
ID: 16955355
You need to assign the desired value to lblPathway.Text, not just lblPathway. On the other hand, fieldB most likely wouldn't have a .Text designation; the field itself is simply a text item. If fieldA is a numeric field, you wouldn't put quotes around it when you're doing the comparison.

So your code would probably be more like:

If dsPathway.fieldA = 1 Then
   lblPathway.Text = "IMG" & dsPathway.fieldB
Else
   lblPathway.Text = dsPathway.fieldB
End If
0
 
LVL 20

Accepted Solution

by:
ElrondCT earned 1500 total points
ID: 16955378
The key to whether fieldA references need to be in quotes is whether or not the field is defined as numeric, not whether it has numbers in it. If it's defined as a string (text) but the text is all numbers, you'll need to put a quote around "1"; if the database definition is of a numeric datatype, you wouldn't use the quotes. VB's Intellisense will tell you which is correct.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

719 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