Solved

lable text syntax

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

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…

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