VB.NET Property 'Font' is 'ReadOnly' - Please Help!!

P

Patti

I am building an application using VB.NET 1.1 and I have an issue with
Font properties in my Radio Button Lists and Check Box Lists. My issue

is that the Font Names and Font Size for these controls have become
"Read Only" and I have no idea how they became read only. I didn't set

anything to read only and was able to change these fonts just last week

- so I must have messed something up. Below is a snippet of my HTML
code I used to assign the font properties and also my attempt in VB.NET

code:

HTML:


<asp:radiobuttonlist id="rblAuditType" Width="100%" Runat="server"
AutoPostBack="False" Font-Size="XX-Small"
Font-Name="Tahoma"
RepeatDirection="horizontal" RepeatColumns="3"
Font-Names="Arial"></asp:radiobuttonlist>
<!--No matter what I change the Font-Size or Font-Name too, it always
displays as Arial, X-Small-->


VB.NET
Me.rblAuditType.Font = New System.Drawing.Font("Tahoma", 8.0F,
System.Drawing.FontStyle.Bold)
'When I try the above code I recieve a compiler error message that says

Property 'Font' is 'ReadOnly'


Any suggestions would be much appreciated!
 
J

Jeff Jarrell

when you need to change the font, create a new font object and assign that
to the control...
 
P

Patti

Thank you very much for responding! I have tried creating a font
object and assigned it to the control, but I continue to get the error
message that the "Property Font is Read Only." Perhaps you can see
what I'm doing wrong. I have tried three different methods below in my
page load.

First attempt:
Dim newfont As Font
newfont = New System.drawing.Font("Arial", 8)

rblQAType.Font = newfont

Second attempt:
Dim num As FontUnit

rblQAType.Font.Name = "arial"
rblQAType.Font.Size = num.Point(6)

Third attempt:
Dim MyFont As New Font("Arial", 6, FontStyle.Regular,
GraphicsUnit.Point)

For Each Control As Control In Me.Controls
Try
rblQAType.Font = MyFont
Catch ex As Exception
End Try
Next

Thanks in advance for any suggestions!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top