473,386 Members | 1,962 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,386 software developers and data experts.

textbox -usercontrol problem

I create my own usercontrol which is [Inherits
System.Windows.Forms.TextBox], my purpose is set all textbox's font into the
same. Now , I can do it by using the following code
Protected Overrides Sub InitLayout()
Me.Font = New System.Drawing.Font("SimSun", 8)
.........
However, during design mode I want to set the font into larger size e.g font
size 9, I can run it sucessfully in the 1st time, if I amend the form during
design mode again, the font size changed back to '8' again,
Please help `~
Nov 21 '05 #1
1 1603
You could shadow the Font property of the base control in the inherited control

Private _Font As Font = New Font("Times", 10, FontStyle.Regular)
Public Shadows Property Font() As Font
Get
Return Me._Font
End Get
Set(ByVal Value As Font)
Me._Font = Value
MyBase.Font = Value
End Set
End Property

Also, override OnCreateControl in your inherited control.

Protected Overrides Sub OnCreateControl()
MyBase.Font = Me.Font
MyBase.OnCreateControl()
End Sub

cf******@charlesfarriersoftware.com

"Agnes" wrote:
I create my own usercontrol which is [Inherits
System.Windows.Forms.TextBox], my purpose is set all textbox's font into the
same. Now , I can do it by using the following code
Protected Overrides Sub InitLayout()
Me.Font = New System.Drawing.Font("SimSun", 8)
.........
However, during design mode I want to set the font into larger size e.g font
size 9, I can run it sucessfully in the 1st time, if I amend the form during
design mode again, the font size changed back to '8' again,
Please help `~

Nov 21 '05 #2

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

Similar topics

4
by: Jurjen de Groot | last post by:
I'm developing a ASP.NET/VB.NET web application. (VS.NET 2003) I've created several webpages, but on two pages one textbox colors yellow (the background) and I can't get the background to appear...
0
by: Luis Esteban Valencia | last post by:
am trying to databind within an asp:textbox control. I have tried many variations found here but nothing seems to work. It works fine if I use a regular HTML textbox input though. Here is what I...
7
by: I am Sam | last post by:
I have a DataGrid that is passing information to a stored procedure properly but the parameters aren't being casted properly. I was woundering if anyone can tell me how I should properly cast the...
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: Steve | last post by:
I am new to vb.net. I have a textbox. I want the user to be able to only enter numbers between 2 and 12 into the textbox. Is there a way to do this? Thanks for any help.
2
by: simon | last post by:
hello, new to vb.net, have a few questions about DataGrid. I have a dataGrid that is working pulling a dataset back from a stored proc and binding to the datagrid for display the datagrid's...
2
by: Adam Honek | last post by:
I have a form. It has serveral text boxes for user data entry. I could of course write code to check if each is empty before proceeding to save this data to a file. Is there any global way...
0
by: mamun | last post by:
Hi All, I have the following situation. I have 10 rows in a form. In each row there are six textbox controls. The users can enter any number of rows of records (either none or upto 10). I...
8
by: Marco Pais | last post by:
Hi there. How can I change the background color of a textbox when it gets the focus? I can handle the "Enter" event and do this private void txtDummie_Enter(object sender, EventArgs e) { ...
1
by: Andy B | last post by:
I have this code: protected void EditEventsWizard_NextButtonClick(object sender, WizardNavigationEventArgs e) { //get the values from the DetailsView TextBox StartTime =...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.