Solved

lable text syntax

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
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…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

760 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now