Custom Control Property Problem 
Author Message
 Custom Control Property Problem

Hi,
    I have created a control that inherits a textbox. At runtime and design
time I am unable to have changes display in the textbox in the control. For
example if i set the value of .Text to "10" then access through a
msgbox(TextBox.Text) the value of 10 is displayed but does not show in the
text box. No property i change or set duing design time or run time effect
the text box. Here is the code I am using to define the control.

Public Class ZipCodeTextBox

Inherits System.Windows.Forms.TextBox

Private Sub txt_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles txt.KeyPress

    Dim KeyAscii As Integer = Asc(e.KeyChar)

    Dim str As String

    If KeyAscii < 48 Or KeyAscii > 57 Then
        e.Handled = True
        Exit Sub
End If
txt.SelectionStart = Len(txt.Text)
e.Handled = True
End Sub

Does anyone have an idea why this would be happening?

--
Eric John Seneca
Nichware Consulting, LLC
System and Development Manager



Fri, 04 Nov 2005 21:42:03 GMT  
 Custom Control Property Problem

Quote:
>-----Original Message-----
>Hi,
>    I have created a control that inherits a textbox. At
runtime and design
>time I am unable to have changes display in the textbox
in the control. For
>example if i set the value of .Text to "10" then access
through a
>msgbox(TextBox.Text) the value of 10 is displayed but

does not show in the

Quote:
>text box. No property i change or set duing design time
or run time effect
>the text box. Here is the code I am using to define the
control.

>Public Class ZipCodeTextBox

>Inherits System.Windows.Forms.TextBox

>Private Sub txt_KeyPress(ByVal sender As Object, ByVal e
As
>System.Windows.Forms.KeyPressEventArgs) Handles
txt.KeyPress

>    Dim KeyAscii As Integer = Asc(e.KeyChar)

>    Dim str As String

>    If KeyAscii < 48 Or KeyAscii > 57 Then
>        e.Handled = True
>        Exit Sub
>End If
>txt.SelectionStart = Len(txt.Text)
>e.Handled = True
>End Sub

>Does anyone have an idea why this would be happening?

>--
>Eric John Seneca
>Nichware Consulting, LLC
>System and Development Manager

>.

Hai,
 I did not get the clear idea of what and do u want? Can u
be more specific. i.e. u want the textbox to display 10
all the time or need to input only no's.

Bye
Vetri



Fri, 04 Nov 2005 22:22:47 GMT  
 Custom Control Property Problem
Thanks for responding,

    The basic problem I am having is that although the properties of a text
box have been inherited for the control you cannot set any of those
properties at runtime. For example if I change the font color to red nothing
changes in the text box. Basically I have a custom control, dropped in a
text box, and added the code below. Basically I am trying to figure out how
to associate the textbox properties to those control properties so that when
I assign .Text is displays or I change the font color and it changes.

Eric

Quote:

> >-----Original Message-----
> >Hi,
> >    I have created a control that inherits a textbox. At
> runtime and design
> >time I am unable to have changes display in the textbox
> in the control. For
> >example if i set the value of .Text to "10" then access
> through a
> >msgbox(TextBox.Text) the value of 10 is displayed but
> does not show in the
> >text box. No property i change or set duing design time
> or run time effect
> >the text box. Here is the code I am using to define the
> control.

> >Public Class ZipCodeTextBox

> >Inherits System.Windows.Forms.TextBox

> >Private Sub txt_KeyPress(ByVal sender As Object, ByVal e
> As
> >System.Windows.Forms.KeyPressEventArgs) Handles
> txt.KeyPress

> >    Dim KeyAscii As Integer = Asc(e.KeyChar)

> >    Dim str As String

> >    If KeyAscii < 48 Or KeyAscii > 57 Then
> >        e.Handled = True
> >        Exit Sub
> >End If
> >txt.SelectionStart = Len(txt.Text)
> >e.Handled = True
> >End Sub

> >Does anyone have an idea why this would be happening?

> >--
> >Eric John Seneca
> >Nichware Consulting, LLC
> >System and Development Manager

> >.

> Hai,
>  I did not get the clear idea of what and do u want? Can u
> be more specific. i.e. u want the textbox to display 10
> all the time or need to input only no's.

> Bye
> Vetri



Fri, 04 Nov 2005 22:30:38 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Custom Control Property Problem

2. Q: ActiveX custom control - property window problem

3. Q: ActiveX custom control - property window problem

4. Q: ActiveX custom control - property window problem

5. VB6: Property Sheets Bug?, Custom Controls and properties

6. Custom Property changes in Custom Outlook Form

7. Custom Property refresh problem in A97

8. Custom property page problems

9. Problems adding custom property pages

10. Problem accessing custom property cells

11. Problem with list of pages in a custom property

12. Automation/setting of doc custom properties problem

 

 
Powered by phpBB® Forum Software