Subject: Re: Text Property on Multi- Control User Control
Date: Tue, 30 Sep 2003 17:23:30 +1000
Lines: 166
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <#mi#
[email protected]>
Newsgroups: microsoft.public.dotnet.languages.vb
NNTP-Posting-Host: c211-28-48-12.eburwd1.vic.optusnet.com.au 211.28.48.12
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP11.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vb:142454
X-Tomcat-NG: microsoft.public.dotnet.languages.vb
Hi Peter,
Thanks for the demo code which I have tried. I still find that the Text
Property Value is not persisted when you build a form that the control is
sited on or even if you save a project and reload it. It seems to work
correctly except for the persistence. This is not an immediate problem for
me but I would like to know how to resolve this because I am sure that at
sometime in the future I will want to preset a value in here.
At least I now know the behaviour has nothing to do with the Infragistics
Text Editor.
Hi Martin,
Here is my demo code using a textbox in a usercontrol.
Imports System.ComponentModel
Public Class UserControl1
Inherits System.Windows.Forms.UserControl
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'UserControl1 overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form
Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents Button1 As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.TextBox1 = New System.Windows.Forms.TextBox
Me.Button1 = New System.Windows.Forms.Button
Me.SuspendLayout()
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(16, 40)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.TabIndex = 0
Me.TextBox1.Text = "TextBox1"
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(24, 96)
Me.Button1.Name = "Button1"
Me.Button1.TabIndex = 1
Me.Button1.Text = "Button1"
'
'UserControl1
'
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.TextBox1)
Me.Name = "UserControl1"
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub UserControl1_Load(ByVal sender As System.Object, ByVal e
As
System.EventArgs) Handles MyBase.Load
Me.Text = "hello"
End Sub
<Browsable(True)> _
Overrides Property Text() As String
Get
Return MyBase.Text
End Get
Set(ByVal Value As String)
TextBox1.Text = Value
MyBase.Text() = Value
End Set
End Property
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
MsgBox(Me.Text)
End Sub
End Class
You may have a try and let me know if this does the job for you.
Did I misunderstand you meaning?
Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure!
www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
--------------------
From: "Martin Horner" <
[email protected]>
Subject: Text Property on Multi- Control User Control
Date: Tue, 30 Sep 2003 08:27:03 +1000
Lines: 29
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <
[email protected]>
Newsgroups: microsoft.public.dotnet.languages.vb
NNTP-Posting-Host: c211-28-48-12.eburwd1.vic.optusnet.com.au 211.28.48.12
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vb:142353
X-Tomcat-NG: microsoft.public.dotnet.languages.vb
Hi,
I hope this is the right newsgroup for this question.
I have just created a simple control comprising a third party text editor
(Infragistics) and a couple of button controls. I have attempted to
handle
the Text property with the following code:
<Browsable(True)> _
Overrides Property Text() As String
Get
Return MyBase.Text
End Get
Set(ByVal Value As String)
MyBase.Text()
UltraTextEditor1.Text = Value
End Set
End Property
I get the Text property in the Property Pane but I can't get it to
persist
the value. It is as if I were failing to maintain a Property bag. If I
change the property name to Display Text and just delegate to
UltraTextEditor1.Text it works fine.
I think that there must be an easy way to do this. Does anyone know what
it
is please?