ASP.net VB.net Set Font of label on Site.Master

Posted on 2013-10-21
Medium Priority
Last Modified: 2013-10-22

I need to set the font of a label on my Site.Master file.
I have the following code but get an error on the second line
Property 'Font' is ReadOnly
             Dim lbl1 As Label = DirectCast(Master.FindControl(oControl_Name), Label)
               lbl1.Font = oFont
Question by:Murray Brown
  • 2
LVL 30

Accepted Solution

Alexandre Simões earned 2000 total points
ID: 39590529
As you can see on the documentation
the property is Readonly, you have to set each value separately
lbl1.Font.Name = oFont.Name
lbl1.Font.Size = oFont.Size
// and so on...

Open in new window

LVL 30

Expert Comment

by:Alexandre Simões
ID: 39590535
Anyway, styling will be much easier if you use CSS instead of trying to code it in the back-end.

Author Closing Comment

by:Murray Brown
ID: 39590676
thanks very much

Featured Post

Train for your Pen Testing Engineer Certification

Enroll today in this bundle of courses to gain experience in the logistics of pen testing, Linux fundamentals, vulnerability assessments, detecting live systems, and more! This series, valued at $3,000, is free for Premium members, Team Accounts, and Qualified Experts.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
When you have multiple client accounts to manage, it often feels like there aren’t enough hours in the day. With too many applications to juggle, you can’t focus on your clients, much less your growing to-do list. But that doesn’t have to be the cas…
Watch the video of Kernel Migrator for SharePoint, which demonstrate the process easily of migration from SharePoint to SharePoint, OneDrive for Business & Google Drive servers, Public Folder to SharePoint, File Server to SharePoint. The tool has va…

621 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