473,662 Members | 2,382 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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._indentifier s(Me._indentifi ers.GetUpperBou nd(0) + 1)
Me._indentifier s(Me._indentifi ers.GetUpperBou nd(0)) = New
Identifier(char acters, color)
End Sub

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

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

Public Property FormatCharacter s() As String
......
Public Property Color() As System.Drawing. Color
.....
Public Sub New()
Me._formatChara cters = ""
Me._color = System.Drawing. Color.Blue
End Sub

Public Sub New(formatChara cters As String, color as System.Drawing. Color)
me._formatChara cters = formatCharacter s
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 1017

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

Similar topics

2
11104
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 and a hotfix has been prepared. The supporting KB article and hotfix download link have yet to be posted, but I can provide you with the following information for those requiring an immediate fix:
6
3398
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 sized strangely using the .RTFHeight property of the control. Specifically, lines of text get cut off the bottom of the control when I use the code provided in the sample report on the lebans.com site. It seems that when there is Chinese text,...
7
1516
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
2101
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 to setup debugging for a Windows Form control. I cannot find any documentation or articles on setting up the same facility for a Web control. Any help on setting the control library project to debug the design-time code would be greatly...
7
2990
by: Shimon Sim | last post by:
I have a custom composite control I have following property
0
1091
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, the control doesn't update until I change something in the aspx and change to design view. I can't understand why because if you try to update a DropDownList with the collection editor, the control updates as soon as you change something in the...
3
1554
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 System.Object, ByVal e As System.EventArgs) Handles TxtEmail.TextChanged If Session("Email") <> Me.Email Then Session("Email") = TxtEmail.Text 'or me.email End If End Sub
0
3254
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 time. If I type the code in the aspx manually it does get parsed correctly though. This is an example of the aspx code that gets parsed correctly. For some reason, if I changed update the Tab property of the control through the GUI at design...
1
3005
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 control at the design time. Unfortunately, my custom control does not refresh at design time when a property is changed.
0
8343
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8856
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8762
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8545
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6185
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5653
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4179
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4347
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1747
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.