Set font programatically on text object in CR.net

I am trying to dynamically set the font and color of a text object in a section of a cr.net report. The code listed only sets the color and font on the first embedded field. These are simple database generated address labels but I canoo figure out how to access (reference) individual embeded fields or tell the report to set the font and color on the completetext object.
Dim section As Section = report.ReportDefinition.Sections.Item("Section3")
        Dim textObject As TextObject = section.ReportObjects("Text4")
 
        textObject.Color = Color.Red
        textObject.ApplyFont(New Font("Arial", 8.25F))

Open in new window

jtesdallAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mlmccCommented:
I don't believe you can dynamically access the individual embedded fields.

You can format them by selecting them from the textbox and right clicking
Choose FORMAT FIELD
You should be able to use the formula buttons on the FONT tab to set the values you want.

mlmcc
0
jtesdallAuthor Commented:
Yes, but I want to do this programatically. Basically based on certain criteria at runtime I want to change the font and color on these labels.

I may have found a solution but it is a work around. I duplicated the text object and set the new font and color I want. Then at runtime I set the length of the text object I don't want to zero so the one I do want displays. This seems to work for now, but setting the font on the text object should have worked for the whole object instead of just the first embedded field. I guess this is a bug.
0
mlmccCommented:
The formula method I mentioned is at runtime.  Is the information you use to set the color available in the report?

mlmcc
0
C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

jtesdallAuthor Commented:
No its not. I just want people to be able to select a standard font or script font for printing out address labels from our database with my VB.net app.
0
Computer101Commented:
PAQed with points refunded (500)

Computer101
EE Admin
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jensbilgravCommented:
Why were points awarded for this solution? It doesn't say anything!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.