473,394 Members | 1,787 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Textbox property

if i have a textbox and want to change the text inside the textbox into
(blod-italic)
using buttons

i try this
textbox1.font=font.italic; \\ for the button italic
and its not work

and give me error-> can'y implicitly convert type bool to system.drawing .font
plz someone tell me how and why?

--
Islam Khalil,
Jun 26 '06 #1
4 7307
Islam,

When you say 'Font.Italic', you are returning the boolean Italic
property from the Font property that is exposed.

Rather, what you want to do is:

textbox1.Font.Italic = true;

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"SemSem" <Se****@discussions.microsoft.com> wrote in message
news:F3**********************************@microsof t.com...
if i have a textbox and want to change the text inside the textbox into
(blod-italic)
using buttons

i try this
textbox1.font=font.italic; \\ for the button italic
and its not work

and give me error-> can'y implicitly convert type bool to system.drawing
.font
plz someone tell me how and why?

--
Islam Khalil,

Jun 26 '06 #2
SemSem wrote:
if i have a textbox and want to change the text inside the textbox into
(blod-italic)
using buttons

i try this
textbox1.font=font.italic; \\ for the button italic
and its not work

and give me error-> can'y implicitly convert type bool to system.drawing
.font plz someone tell me how and why?


Font font = new Font(textBox1.Font, System.Drawing.FontStyle.Bold |
System.Drawing.FontStyle.Italic);
textBox1.Font = font;
--
Tom Porterfield

Jun 26 '06 #3
Nicholas Paldino [.NET/C# MVP] wrote:
Islam,

When you say 'Font.Italic', you are returning the boolean Italic
property from the Font property that is exposed.

Rather, what you want to do is:

textbox1.Font.Italic = true;

Hope this helps.


Isn't the .Italic property on Font read-only?
--
Tom Porterfield
Jun 26 '06 #4
Oops, that's wrong, the Bold property is read-only. See Tom's response
for the correct answer.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:eB**************@TK2MSFTNGP04.phx.gbl...
Islam,

When you say 'Font.Italic', you are returning the boolean Italic
property from the Font property that is exposed.

Rather, what you want to do is:

textbox1.Font.Italic = true;

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"SemSem" <Se****@discussions.microsoft.com> wrote in message
news:F3**********************************@microsof t.com...
if i have a textbox and want to change the text inside the textbox into
(blod-italic)
using buttons

i try this
textbox1.font=font.italic; \\ for the button italic
and its not work

and give me error-> can'y implicitly convert type bool to system.drawing
.font
plz someone tell me how and why?

--
Islam Khalil,


Jun 26 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Chumley the Walrus | last post by:
I'm using this sql parameter: MyCommand.Parameters("@Sport").value = Server.HtmlEncode(sport) to get a value from a textbox control: <asp:TextBox Name="sport" id="sport"...
0
by: Jonas L | last post by:
Hi, I need to create a textbox which acts as a normal textbox but with the following extra requirements: 1) In-focus color, when the textbox gets focus the backcolor property of the textbox...
1
by: Martin | last post by:
Dear Group Sorry for bothering you again but I need expert advice on this. I have placed a HTML textbox on my aspx form and converted it to run as a server control. At some point in my code I...
2
by: Alex Shirley | last post by:
HI I'm trying to iterate through all the textboxes on a webpage and trim them for spaces. i.e. If a user enters " hello world " we correct it to "hello world" So far I've come up with...
7
by: siddhiash | last post by:
Hi Friends I want to add PasswordChar Property which shows ****** for string which I type in PropertyGrid Control. Regards, Siddharth
11
by: Keith | last post by:
I apologize for those of you who think I'm posting on the same topic. It is not that I don't appreciate all of your comments - and I'm definitely reading them all - but I think I have a differing...
2
by: Mamatha | last post by:
Hi I want to add an icon to the textbox's text. I don't know how to display icon in textbox in VB.NET. If any one knows please let me know. Thanks in advance. Mamatha
6
by: JohnR | last post by:
I have a table with 1 row which is used to hold some application wide items (one item per field, hence I only need 1 row). I want to bind one of the fields to a textbox. After setting up the...
1
by: rn5a | last post by:
I want to create a custom control that encapsulates a Button & a TextBox. When the Button is clicked, the user is asked a question using JavaScript confirm (which shows 2 buttons - 'OK' &...
4
by: Dean Slindee | last post by:
Anyone got a quick and easy way to change the background color on a textbox after the user has change the text value. Already have lots of forms written, so an approach that does not depend on...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.