sir please
How can design textbox in visual basic6.0 with sample
v-lli wrote:
Hi Anis,Based on my understanding, you'd like to create a 'common' TextBox in
15-Aug-07
Hi Anis
Based on my understanding, you'd like to create a 'common' TextBox in your
project, so that all the TextBoxes in the project will have the same
properties. If I'm off base, please feel free to let me know
In my opinion, you could create a custom control derived from TextBox, and
then use this custom control in your projects. If you change a property of
an instance of the custom control in the project, e.g. the BackColor
property, other instances of the custom control won't change with it
not responding their after, for this i found wht was the error also
taking the most recently assigned, and not changed their after
Could you please tell me what you mean in the above sentences
Sincerely
Linda Li
Microsoft Online Community Suppor
=================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#noti
ications
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx
=================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Previous Posts In This Thread:
On Wednesday, August 15, 2007 7:58 AM
Kanna wrote:
Overriding TEXTBOX controls vb.net
hi
im using vb.net 2005 with dotnet framework 2.0, i hv a questio
im using 2-3 forms, for these forms having number of textboxes, can u advice
me, if i create a common class for textbox properties, like backcolor, font,
forecolor, it should take it for all the controls
how can i do this..
i tried this method, and succeeded too, but if i change any of the property
in the textbox, then its not changing thier after..
here my code goes
Public Class txtTestBxCusto
Inherits System.Windows.Forms.TextBo
Public Sub New(
MyBase.Enabled = Tru
MyBase.BackColor = System.Drawing.Color.Whit
MyBase.Font = New System.Drawing.Font("Tahoma", 9.0!,
System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0,
Byte)
MyBase.ForeColor = System.Drawing.Color.Re
End Su
End Clas
in the new textbox creations, im assigning the textbox like this..
Me.txtOrdno = New salesPV.TextBoxCusto
like this, im assigning the controls to all the textboxes, whereever im
using, but once i change any property of the control, then this base class is
not responding their after, for this i found wht was the error also
once i changed the border, then the backcolor and forecolor and font is
taking the most recently assigned, and not changed their after
how to get out of this problem
advic
thanks for understandin
Anis
On Wednesday, August 15, 2007 11:40 PM
v-lli wrote:
Hi Anis,Based on my understanding, you'd like to create a 'common' TextBox in
Hi Anis
Based on my understanding, you'd like to create a 'common' TextBox in your
project, so that all the TextBoxes in the project will have the same
properties. If I'm off base, please feel free to let me know
In my opinion, you could create a custom control derived from TextBox, and
then use this custom control in your projects. If you change a property of
an instance of the custom control in the project, e.g. the BackColor
property, other instances of the custom control won't change with it.
not responding their after, for this i found wht was the error also,
taking the most recently assigned, and not changed their after,
Could you please tell me what you mean in the above sentences?
Sincerely,
Linda Liu
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
On Thursday, August 16, 2007 10:47 AM
VorTechS wrote:
Re: Overriding TEXTBOX controls vb.net
Komandur Kannan wrote:
I think your problem here is that you are not invalidating the control
to force it to refresh once you have assigned the new properties.
Take a look a .Invalidate
On Thursday, August 16, 2007 8:52 PM
Kanna wrote:
Hi linda,Its not succeeded, due to custom controls form color and textcolor
Hi linda,
Its not succeeded, due to custom controls form color and textcolor mismatch,
if you advice me with some sample codes, it will be great, thanks
Anis
"Komandur Kannan" wrote:
On Thursday, August 16, 2007 9:08 PM
Kanna wrote:
hi linda,i think wht you said im trying now, means, im creating the
hi linda,
i think wht you said im trying now, means, im creating the usercontrol with
which the properties are needed im setting it, like color/fonts, and since
you said, other properties wont affect, this wil be the great idea of using
so, and thanks very much for your reply
thanks
Anis
"Linda Liu [MSFT]" wrote:
On Thursday, August 16, 2007 9:11 PM
Kanna wrote:
Hi Linda,thanks for your reply, and once i create the control which is from
Hi Linda,
thanks for your reply, and once i create the control which is from the
derived class its not reflecting if i make any design time changes means, ie
take this example,
i created one public clas for the type of textbox,and their im fixing the
color properties, ie,
Public Class GSsgTxtBx
Inherits System.Windows.Forms.TextBox
Public Sub New()
MyBase.BackColor = System.Drawing.Color.Violet
MyBase.Font = New System.Drawing.Font("Tahoma", 9.0!,
System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0,
Byte))
MyBase.ForeColor = System.Drawing.Color.RosyBrown
End Sub
End Class
and theirafter, which textbox i wanted to derive this class properties, im
assining so, its working fine, wht i meant in that sentence was,
once all done, as a designer im changing some property of that assigned
textbox in the design time, say for example border i changed, theirafter this
base class is not overriding the textbox, ie, if i change the color in the
above base class, its not reflecting in the original textbox, that is wht im
asking, and hope you can understand
and since im using many textboxes in all over the forms, i do want to change
some of its properties in common, like font/color/border like, thats why im
thinking of this, and the method you are advising is USERCONTROL?, example
please, thanks
Anis
"Linda Liu [MSFT]" wrote:
On Thursday, August 16, 2007 9:18 PM
Kanna wrote:
Hi Linda,i created the custom control with its class, as belowPublic Class
Hi Linda,
i created the custom control with its class, as below
Public Class usrctlSsgIts
Inherits System.Windows.Forms.UserControl
Public Sub New()
' This call is required by the Windows Form Designer.
InitializeComponent()
MyBase.Refresh()
' Add any initialization after the InitializeComponent() call.
End Sub
Public Overrides Property BackColor() As System.Drawing.Color
Get
txtSSGIts.BackColor = System.Drawing.Color.DarkSeaGreen
End Get
Set(ByVal value As System.Drawing.Color)
' MyBase.BackColor = value
End Set
End Property
'Public Overridable Property BackColor1() As System.Drawing.Color
' Get
' BackColor1 = txtSSGIts.BackColor
' End Get
' Set(ByVal value As System.Drawing.Color)
' txtSSGIts.BackColor = value
' End Set
'End Property
Public Overridable Property Font1() As System.Drawing.Font
Get
Font1 = txtSSGIts.Font
End Get
Set(ByVal value As System.Drawing.Font)
txtSSGIts.Font = value
End Set
End Property
End Class
its incorporated with the project, and global changes and all fine, but here
im not able to change the color in the form, its coming like a custom control
color itself, how can i change, say for example, in a form, im having 20
textboxes means, some of the textbox, i may highlight the color for price
changes and all, ( once i derived from the custom control also, i hv to do
some modifications in the code itself ), so this should allow me to do the
changes, since this will done in the code itself, but its not allowing so,
how can i get rid of this problem
thanks
Anis
"Komandur Kannan" wrote:
On Friday, August 17, 2007 8:53 AM
v-lli wrote:
Hi Anis,Thank you for your prompt reply.
Hi Anis,
Thank you for your prompt reply.
I think I understand your real question now. As I understand, you use a lot
of TextBoxes on your forms, and you'd like to control the properties of all
these TextBoxes from one place, e.g. a class, and needn't set the
properties for these TextBoxes one bye one.
You create a new class derived from TextBox and set the properties e.g.
BackColor, ForeColor, Font and etc in the new class's constructor. Then you
add an instance of the derived TextBox on a form and the derived TextBox
instance has the values for these properties you set in the derived TextBox
class.
However, if you change the value for a property, e.g. the BackColor in the
derived TextBox class's constructor and build the project, the existing
instance of the derived TextBox on the form still has the previous
specified color for the BackColor and this is the problem.
The reason of this problem is that the default value of the BackColor
property of TextBox is the color of Control. If a value other than the
default value of a property is assigned to a TextBox in the designer, the
value will be serialized by the Form Designer into the InitializeComponent
method. Then even if you change the value of the BackColor property in the
derived TextBox class's constructor to another color, the existing derived
TextBox instance still keeps the previous backcolor.
To solve this problem, we need to redefine the default values for the
properties you want, so that the values that equal to the values specified
in the constructor will not serialized into code and if you change the
values in the derived TextBox class later, the existing instances of the
derived TextBox will reflect the new value at design time as well as run
time.
The following is a sample.
Imports System.Windows.Forms
Imports System.ComponentModel
Public Class MyTextBox
Inherits TextBox
Sub New()
Me.BackColor = Color.Yellow
Me.Font = New Font("Maiandra GD", 9, FontStyle.Italic)
End Sub
<DefaultValue(GetType(Color), "Yellow")> _
Public Overrides Property BackColor() As System.Drawing.Color
Get
Return MyBase.BackColor
End Get
Set(ByVal value As System.Drawing.Color)
MyBase.BackColor = value
End Set
End Property
<DefaultValue(GetType(Font), "Maiandra GD, 9pt, style=Italic")> _
Public Overrides Property Font() As System.Drawing.Font
Get
Return MyBase.Font
End Get
Set(ByVal value As System.Drawing.Font)
MyBase.Font = value
End Set
End Property
End Class
FYI, to get the string that represents a Font, you can set the Font
property of a Form in the Properties window to any Font you want and then
copy the text in the Font property item entry in the Properties window.
Hope this helps.
If you have anything unclear, please feel free to let me know.
Sincerely,
Linda Liu
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
On Tuesday, August 21, 2007 8:41 AM
v-lli wrote:
Hi Anis,How about the problem now?
Hi Anis,
How about the problem now?
If the problem is still not solved or you have any question, please feel
free to let me know.
Thank you for using our MSDN Managed Newsgroup Support Service!
Sincerely,
Linda Liu
Microsoft Online Community Support
Submitted via EggHeadCafe - Software Developer Portal of Choice
SharePoint - Managing Unused or Archive sites automatically
http://www.eggheadcafe.com/tutorials/aspnet/96bf1f1c-ab6f-43f1-9a5b-a2a8deb60cad/sharepoint--managing-unu.aspx