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

Win Control and update at design time

Hi all

Im currently constructing a Windows control that inherits from RichTextBox,
but I'm having a bit of trouble with updating the control at design time.

The senario is SIMPLIFIED as follows:

My RichTextBox control :

Public Class Crtb
Inherits RichTextBox

private _indentifiers() as Identifier ' An array of Indentifier objects

Public Sub RefreshRtb
' Refreshes the Box acording to the Identifiers
End Sub

Public Overloads Sub AddIndentifier(ByVal characters As String, ByVal
color As System.Drawing.Color)
ReDim Preserve Me._indentifiers(Me._indentifiers.GetUpperBound(0) + 1)
Me._indentifiers(Me._indentifiers.GetUpperBound(0) ) = New
Identifier(characters, color)
End Sub

End Class
An Identifier Class holding a KeyWord as _formatCharacters and a Color to
use in the RTB for this keyword:

< Serializable()> _
Public Class Identifier
Private _formatCharacters As String
Private _color As System.Drawing.Color

Public Property FormatCharacters() As String
......
Public Property Color() As System.Drawing.Color
.....
Public Sub New()
Me._formatCharacters = ""
Me._color = System.Drawing.Color.Blue
End Sub

Public Sub New(formatCharacters As String, color as System.Drawing.Color)
me._formatCharacters = formatCharacters
me._color = color
End Sub

End Class
This is very simplified but should give a picture of the senario.

Now when adding a control to a form I can edit the Identifiers property
array at design time, and so add new Identifiers and e.g. change the color of
the existing ones.

My problem is that I want the RTB control to refresh itself on designtime
when I change e.g. a color property of one of the Identifiers objects in the
array. This can be done by adding an event to the Identifier class and
thereafter adding a handle that calls RefreshRtb for this event each time a
new Identifier is added to The RTB.

This though gives me a big problem since an eventhandler is not able to be
serialized, which meens that the refresh functionallity disappears when I run
the app and return to design mode. As far as I know the control saves it's
state in the resx file, but since the event handlers can't be serialized this
part of the control is lost.

This is a senario that is used in many controls out there, so I hope that
someone is able to tell me how to get this designtime refresh functionallity
in some other way.

Thanks in advance

Allan
Nov 21 '05 #1
0 1006

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

Similar topics

2
by: Randy Birch | last post by:
Reposted as the original is reported as deleted from the server. re: MSComCtl Listview control cashes after installing VB6/VS6 SP6 I have been advised that this problem has been reproduced...
6
by: Bruce Rusk | last post by:
I'm using Stephen Lebans' RTF2 control in a report, and have discovered what may be a slight bug in it. I have a lot of non-Western language (Chinese) text in my RTF field, and such records get...
7
by: Jacky Luk | last post by:
Does anyone know of a downloadable Line ActiveX control which allows me to plot straight lines on a VC++.NET form? Thanks Jack
4
by: jim | last post by:
I am trying to debug a user written web control and web control designer. I found an article “Building Windows Forms Controls and Component with Rich Design-Time Features” that describes how...
7
by: Shimon Sim | last post by:
I have a custom composite control I have following property
0
by: pedrobernabeu | last post by:
I have a custom control with a ListItemCollection. If I add items by hand in the aspx and switch to design time view, everything works fine. However if I add items through the Collection Editor,...
3
by: c676228 | last post by:
Hi all, I have an event in user control email to handling email change when user want to change the input for email address. Here it is In email.ascx.vb: Protected Sub UpdateEmail(ByVal sender As...
0
by: Jeremy Chapman | last post by:
I have included below virtually all the code to a control I'm trying to build. My issue is that an array list property in my control does not get persisted properly to the aspx page code in design...
1
by: --== Alain ==-- | last post by:
Hi, I still have problem updating my custom control at design time. When i change a property of my custom control in the property window, i would like to see this change immediately on my custom...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...

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.