By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,282 Members | 1,587 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,282 IT Pros & Developers. It's quick & easy.

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

P: n/a
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!

Jan 8 '07 #1
Share this Question
Share on Google+
2 Replies


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

"Patti" <pd*******@worldsavings.comwrote in message
news:11*********************@51g2000cwl.googlegrou ps.com...
>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!

Jan 10 '07 #2

P: n/a
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!
Jeff Jarrell wrote:
when you need to change the font, create a new font object and assign that
to the control...

"Patti" <pd*******@worldsavings.comwrote in message
news:11*********************@51g2000cwl.googlegrou ps.com...
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!
Jan 10 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.