Hello,
I'm creating a Windows control that includes a few textboxes. In the form
designer, I want there to be one property that drops down into a few
sub-values for the different text boxes, somewhat akin to how Location and
Size usually work for many standard controls.
(There may be more appropriate ways to do this, but I'm kind of doing it as
a self-tutorial.)
I've tried creating a Property which returns a Structure declared within the
custom control class, but that doesn't seem to work. The form designer
simply represents the Value property in grayed-out text reading
"ctlPhoneNumber TextBox.PhoneNu mberTextBox+Pho neNumber". Any ideas?
Here's a code snippet, if it helps:
***
Public Class PhoneNumberText Box
Inherits System.Windows. Forms.UserContr ol
Private areaCodeStr As String
Private exchangeStr As String
Private suffixStr As String
Private extensionStr As String
Public Structure PhoneNumber
Public AreaCode As String
Public Exchange As String
Public Suffix As String
Public Extension As String
End Structure
Property Value() As PhoneNumber
Get
Dim returnPhoneNumb er As PhoneNumber
returnPhoneNumb er.AreaCode = areaCodeStr
returnPhoneNumb er.Exchange = exchangeStr
returnPhoneNumb er.Suffix = suffixStr
returnPhoneNumb er.Extension = extensionStr
Return returnPhoneNumb er
End Get
Set(ByVal Value As PhoneNumber)
areaCodeStr = Value.AreaCode
exchangeStr = Value.Exchange
suffixStr = Value.Suffix
extensionStr = Value.Extension
End Set
End Property 2 1308
PR wrote:
I've tried creating a Property which returns a Structure declared within
the custom control class, but that doesn't seem to work. The form
designer simply represents the Value property in grayed-out text reading
"ctlPhoneNumber TextBox.PhoneNu mberTextBox+Pho neNumber". Any ideas?
It's doing the best that it can; it's listing your property and
displaying the only value it can get for it, that returned by calling
ToString() on the current value.
You have to build another class that does the translation, back and
forth, between your Property and the Designer's Property Window, then
link it to your new Control using a TypeConverter Attribute.
HTH,
Phill W.
>I've tried creating a Property which returns a Structure declared within
>the custom control class, but that doesn't seem to work. The form designer simply represents the Value property in grayed-out text reading "ctlPhoneNumbe rTextBox.PhoneN umberTextBox+Ph oneNumber". Any ideas?
It's doing the best that it can; it's listing your property and displaying
the only value it can get for it, that returned by calling ToString() on
the current value.
You have to build another class that does the translation, back and forth,
between your Property and the Designer's Property Window, then link it to
your new Control using a TypeConverter Attribute.
Wow. Sounds hard. Thanks for your answer, though. I may just forego
this'un... I can live with the Form Designer not understanding me... This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: drewnoakes |
last post by:
Hi,
I'm developing an application server to which clients will connect over the
network. This server has a variety of entry points, and remoting seems well
suited for those clients written in .NET.
However there are two simple functions that will be accessed from unmanaged
C++, and possibly Java one day. For these I'm considering utilising a
straightforward custom binary protocol. The C++/Java client can open a
socket, send request...
|
by: Peter Seaman |
last post by:
I understand that structures are value types and arrays and classes are
reference types. But what about arrays as members of structures i.e. as in
C
struct x
{
int n;
int a;
}
|
by: Brian Keating EI9FXB |
last post by:
Hello there,
Wonder can anyone point me in the correct direction?
I would like to change the standard list view control so that i can have
alternated rows in a different color, i.e. white grey white grey
And I'd also like to change the color or the first colmn.
What is the best approach for same?
thanks
Brian
|
by: Suzanne |
last post by:
Hi all,
I'm reposting this message as I'm experiencing this problem more and
more frequently :
I really hope someone out there can help me as I've been tearing my
hair out on this one for a good while and I'm getting really
frustrated now!
My problem is this - my custom controls periodically disappear from my
|
by: Techno_Dex |
last post by:
Has anyone come up with a slick way to make Custom Serializable Objects to
behave like DataSets when using WebServices? What I'm looking for is some
way to force the WSDL generated code to create a reference to my custom
object's namespace instead of creating it's own copy of the object in it's
own WS namespace. Either that, or some easy way to move all of the
properties from the Custom Serializable Object into the WSDL generated
object...
| |
by: rizwanahmed24 |
last post by:
Hello
i have made a custom control. i have placed a panel on it. I want this
panel to behave just like the normal panel. The problem i was having is
that the panel on my custom control doesnt accept other controls. The
control i drag drop on it becomes the child of my custom control's
parent form and not the child of my custom control. Then i added this
line
""
before my custom control class (i dont know what this line does). Now
|
by: Peter |
last post by:
Hello,
I'm creating a Windows control that includes a few textboxes. In the form
designer, I want there to be one property that drops down into a few
sub-values for the different text boxes, somewhat akin to how Location and
Size usually work for many standard controls.
(There may be more appropriate ways to do this, but I'm kind of doing it as
a self-tutorial.)
|
by: jehugaleahsa |
last post by:
Hello:
When developing data structures for C#, there is an obvious
performance hit when utilizing primitive types. For instance, a recent
hash table implementation I wrote works exceedingly fast on strings.
It can run through a million randomly generated strings in less than
half of a second (in most tests). The built-in dictionary class takes
close to 10 seconds. (Just trust my measurements; I don't want to
argue about the correctness...
|
by: jehugaleahsa |
last post by:
Hello:
I am experiencing performance related issues when my custom data
structures work with value types. I use generics to prevent boxing
wherever I can. For instance, I use IEqualityComparer, etc. I have
gone through most of my data structures and verified that I don't
compare to null or call methods that would box my value types.
However, I am still experiencing performance problems. I can process
strings faster than I can process...
|
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...
|
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...
| |
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,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |