Hi,
I've created a simple class "GridLines" having 3 properties (Prop1,
Prop2, and Prop3).
in my custom control, i've created a property based on this class
"GridLines".
To show the GridLines properties as my custom control subproperties, i
used an expandable ExpandableObjectConverter class for my GridLineConverter.
therefore in my custom control property window, i have the following thing :
GridLines = Prop1_value, Prop2_value, Prop3_value
- Prop1 : value
- Prop2 : value
- Prop3 : value
Everything works well if i use my custom control subproperties (Prop1,
Prop2, Prop3) to setup the GridLine property (BTW, GridLine property
value is a string).
However, if i type directly to GridLine property field "Prop1_value,
Prop2_Value, Prop3_value", my component raises an error message. I've
checked several times my code, but i must be blind because o do not see
any error.
here is the piece of code which raises the error :
public CGridLine ConvertFromString(object value)
{
string[] values = ((string)value).Split(',');
if (values.Length != 3)
throw new ArgumentException("Could not convert the value !");
try
{
CGridLine GridLine = new CGridLine();
ColorConverter ColorConverter = new ColorConverter();
StringConverter StringConverter = new StringConverter();
GridLine.Lines =
(GridLines)StringConverter.ConvertFromString(value s[0]);
GridLine.Style =
(GridLineStyle)StringConverter.ConvertFromString(v alues[1]);
GridLine.Color =
(Color)ColorConverter.ConvertFromString(values[2]);
// Convert the name of the enumerated value into the corresponding
// enumerated value (which is actually an integer constant).
return GridLine;
}
catch (Exception err)
{
throw new ArgumentException("Could not convert the value \n\n
Error Message : " + err.Message);
}
}
-----------------
thanks for help.
AL. 1 1601
Hi Guys,
i found the problem.
Prop1 and Prop2 are enum types, therefore i had to use :
my_GridLine.Style = (GridLineStyle)Enum.Parse(typeof(GridLineStyle),
values[1], true);
instead of :
GridLine.Style =
(GridLineStyle)StringConverter.ConvertFromString(v alues[1]);
Al.
--== Alain ==-- wrote:
Hi,
I've created a simple class "GridLines" having 3 properties (Prop1,
Prop2, and Prop3).
in my custom control, i've created a property based on this class
"GridLines".
To show the GridLines properties as my custom control subproperties, i
used an expandable ExpandableObjectConverter class for my
GridLineConverter.
therefore in my custom control property window, i have the following
thing :
GridLines = Prop1_value, Prop2_value, Prop3_value
- Prop1 : value
- Prop2 : value
- Prop3 : value
Everything works well if i use my custom control subproperties (Prop1,
Prop2, Prop3) to setup the GridLine property (BTW, GridLine property
value is a string).
However, if i type directly to GridLine property field "Prop1_value,
Prop2_Value, Prop3_value", my component raises an error message. I've
checked several times my code, but i must be blind because o do not see
any error.
here is the piece of code which raises the error :
public CGridLine ConvertFromString(object value)
{
string[] values = ((string)value).Split(',');
if (values.Length != 3)
throw new ArgumentException("Could not convert the value !");
try
{
CGridLine GridLine = new CGridLine();
ColorConverter ColorConverter = new ColorConverter();
StringConverter StringConverter = new StringConverter();
GridLine.Lines =
(GridLines)StringConverter.ConvertFromString(value s[0]);
GridLine.Style =
(GridLineStyle)StringConverter.ConvertFromString(v alues[1]);
GridLine.Color =
(Color)ColorConverter.ConvertFromString(values[2]);
// Convert the name of the enumerated value into the corresponding
// enumerated value (which is actually an integer constant).
return GridLine;
}
catch (Exception err)
{
throw new ArgumentException("Could not convert the value \n\n
Error Message : " + err.Message);
}
}
-----------------
thanks for help.
AL.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Dotnetified |
last post by:
Reposting after about 2 weeks of no response ... thanks if you can help...
----------------------------------------------------------------------------
--------------
To anyone who thinks they...
|
by: spam_me_ not |
last post by:
I already understand that one cannot disable a browser's
forward and back functions. This is a situation where I
have code working in Mozilla V1.6 and would like something
similar for Opera and...
|
by: JDeats |
last post by:
I have a WinForm that is set as an MDIContainer, I have an Panel on
this form that has it's docking property set to "Top". When a spawn an
MDI childform inside my parent all is well untill I...
|
by: harddrive1610 |
last post by:
Hi,
I have just started using VS2005 (ASP.net) and I am running into a new
issue where I can't see the style popup window when you click on the
style ellipses (...) in the property window. the...
|
by: Dominic via DotNetMonster.com |
last post by:
With a little help from someone in this forum, I am currently creating forms
and then embedding them into tabpages, so that I get a display similar to
Lotus Notes. I have one container window, so I...
|
by: mikez |
last post by:
Hi,
We recently built a very basic file management system for a client in
Access 2003 (to use with incoming tif scans). In it we used
Microsoft's Document Imaging activex viewer (from Office...
|
by: Stephany Young |
last post by:
When one uses the System.Diagnostics.Process.Start method to launch a common
or garden Console application, one can set the WindowStyle property of the
StartInfo object to ProcessWindowStyle.Hidden...
|
by: Asterix |
last post by:
Hi Guys,
I know this is probably an easy one, but I am having issues.
Basically, I have a pop-up (child) that controls the parent window.
Clicking on a link on the child window should redirect...
|
by: GinnTech |
last post by:
I have a site that works perfectly in IE6 IE7 FF2 FF3 but not in the
latest Safari.
Here is the issue. I am attempting to call functions within a flash
object. When trying to attempt to...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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,...
|
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...
|
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...
|
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...
|
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,...
| |