473,324 Members | 2,456 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,324 software developers and data experts.

Attribute problem

Hi there
How can i solve this problem??

P Property is here...
Expand|Select|Wrap|Line Numbers
  1.     public partial class combo : ComboBox
  2.     {
  3.         public combo()
  4.         {
  5.             InitializeComponent();
  6.         }
  7.  
  8.         private MyClass p = new MyClass(2, 4);
  9.         public MyClass P
  10.         {
  11.             get { return p; }
  12.             set { p = value; }
  13.         }
  14.     }
  15.  
and MyClass class is here....
Expand|Select|Wrap|Line Numbers
  1.     [TypeConverter(typeof(ExpandableObjectConverter))]
  2.     public class MyClass
  3.     {
  4.         private int _width, _hieght;
  5.         public MyClass()
  6.         {
  7.         }
  8.         public MyClass(int width, int height)
  9.         {
  10.             _width = width;
  11.             _hieght = height;
  12.         }
  13.  
  14.         public int Width
  15.         {
  16.             get { return _width; }
  17.             set { _width = value; }
  18.         }
  19.         public int Height
  20.         {
  21.             get { return _hieght; }
  22.             set { _hieght = value; }
  23.         }
  24.     }
  25.  
Attached Images
File Type: jpg sa.JPG (6.2 KB, 126 views)
Jun 2 '09 #1
7 1535
r035198x
13,262 8TB
What is the problem?
Jun 2 '09 #2
IanWright
179 100+
At a guess you don't want the property to read "test_1.MyClass"?

If this is the case override the ToString() method on MyClass and return a more appropriate value.
Jun 2 '09 #3
thanks.i override the ToString() method but it is readonly now.
for example size property is changeable but my property is not.(problem is attached....)
Attached Images
File Type: jpg untitled.JPG (5.9 KB, 113 views)
Jun 2 '09 #4
it's ok.i find its solution.
very very thanks.....
Jun 2 '09 #5
tlhintoq
3,525 Expert 2GB
@IanWright
I cheat and use the System.IO.Path.GetNameWithoutExtension for things like this.
Feed it "test_1.MyClass" and it trims the 'extension of .MyClass
Jun 2 '09 #6
i don't understand ur meaning.what's profit of cheating in this case?
Jun 2 '09 #7
tlhintoq
3,525 Expert 2GB
The 'right' way really is to override the ToString() method and so forth.
But I'm lazy sometimes. Event though the string isn't a Path, the System.IO.Path functions are written well enough to not scream about it and so I can use them to do my evil bidding <mad scientist laugh>
Jun 2 '09 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: smita | last post by:
Hi, I have an xml file as below <root> <table id =1> <user>abc</user> <age>25</age> </table> <table id = 2> <user>xyz</user>
2
by: Bill Cohagan | last post by:
In my app I'm validating an XML file against an XSD which contains several attribute default value specifications. I'm performing the validation via an xml document load() using a...
5
by: Neil Norfolk | last post by:
I am using C# in Visual Studio 2003. I would like to serialize a class that contains, amongst other things, public delegate void DocumentsPreferencesChange(object env, Documents e); public event...
10
by: Jon Noring | last post by:
Out of curiosity, may a CDATA section appear within an attribute value with datatype CDATA? And if so, how about other attribute value datatypes which accept the XML markup characters? To me,...
5
by: AdSR | last post by:
Hi, I'm having a problem with the Amara toolkit. Try this: >>> from amara import binderytools >>> raw = '<pq:test xmlns="http://example.com/namespace" xmlns:pq="http://pq.com/ns2"/>' >>> rwd...
9
by: =?Utf-8?B?d2luZHNpbQ==?= | last post by:
Hi, I have a project based on .Net 1.1 and VS 2003,now I am trying to upgrade it to .Net 2.0 and VS 2005.The project passes the 'Build Solution',but When I start Debug, it suddenly comes...
0
by: pradip sonar | last post by:
Hello, I am having a problem with Xalan transforming a document containing Japanese characters. (An initial note: the problem does not occur on my Windows development machine, only on the...
18
by: Gabriel Rossetti | last post by:
Hello everyone, I had read somewhere that it is preferred to use self.__class__.attribute over ClassName.attribute to access class (aka static) attributes. I had done this and it seamed to work,...
6
by: Kindler Chase | last post by:
I'm trying to iterate through a set of nodes and then edit/delete specific attributes using XPathNodeIterator. Adding attributes is no problem. My first question is how do I delete an attribute...
2
by: Nathan Sokalski | last post by:
I am attempting to create icons for controls I have created using VB.NET by using the System.Drawing.ToolboxBitmap attribute. I have managed to do this in C# by specifying the path to the *.ico...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
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: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.