Solved

lable text syntax

Posted on 2006-06-21
2
187 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 500 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

740 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