Create custom control change property default 
Author Message
 Create custom control change property default

I am creating a new custom textbox inheriting TexBox

I want to change the default Value for a Textbox.Text
propety.

I have tried:

me.text = "myDefaultValue"

But This must be in proceedure that runs when the
textbox or form is loaded.  What method fires?

I have also tried.
Public Shadows Text as string = "myDefaultValue"
But this overrides its behavior.

Thanks in Advance for any Help.



Wed, 25 May 2005 23:45:46 GMT  
 Create custom control change property default

Hello,

Thank you for using the Microsoft Newsgroups.

You can add the code to New() subroutine. The code looks like:

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
        Dim t As New mytextbox()
        t.Left = 20
        t.Top = 20
        t.Width = 100
        t.Height = 30
        t.Visible = True
        Me.Controls.Add(t)
    End Sub

Public Class mytextbox
    Inherits TextBox
    Public Sub New()
        Me.Text = "default text"
    End Sub
End Class

If you have any questions, please reply to this post.

Regards,  

Jian-Wei Yu
Microsoft Support

This posting is provided "AS IS" with no warranties, and confers no rights.



Fri, 27 May 2005 15:52:52 GMT  
 Create custom control change property default

Thanks for the reply.  I was able to set a default for a custom property
I create per your instructions.  But the text propert continues to
default to the name of the textbox control.

Is there anyway to override this behavior?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Sat, 28 May 2005 02:30:06 GMT  
 Create custom control change property default

Hello,

Thank you for using the Microsoft Newsgroups.

I can use the code to change the text property.

Can you post your code snippet?

Regards,  

Jian-Wei Yu
Microsoft Support

This posting is provided "AS IS" with no warranties, and confers no rights.



Sat, 28 May 2005 09:33:55 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Custom Property changes in Custom Outlook Form

2. Changing default properties of controls

3. Q: Create custom property on form/report controls ?

4. Change Default Account or Change Sender Properties - HELP !

5. Creating properties of custom properties?

6. Change the Default Icon of the Self-created ActiveX control

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

8. Changing the Default duration field to a custom duration field

9. Changing the default custom dictionary through Word VBA

10. Creating custom methods for a custom control

11. create custom icon,custom combobox in custom toolbar

12. create custom icon,custom combobox(to insert values)in custom toolbar

 

 
Powered by phpBB® Forum Software