Click here to Skip to main content
15,920,801 members
Home / Discussions / C#
   

C#

 
QuestionCreating mailbox from web service Pin
VPR10-Jan-06 8:27
VPR10-Jan-06 8:27 
AnswerRe: Creating mailbox from web service Pin
Curtis Schlak.10-Jan-06 9:08
Curtis Schlak.10-Jan-06 9:08 
QuestionShowing check mark in menu item Pin
smurfy3410-Jan-06 8:16
smurfy3410-Jan-06 8:16 
AnswerRe: Showing check mark in menu item Pin
Curtis Schlak.10-Jan-06 8:41
Curtis Schlak.10-Jan-06 8:41 
Questionlabel color in form Pin
zhujp9810-Jan-06 8:09
zhujp9810-Jan-06 8:09 
AnswerRe: label color in form Pin
Curtis Schlak.10-Jan-06 8:34
Curtis Schlak.10-Jan-06 8:34 
GeneralRe: label color in form Pin
shabonaa10-Jan-06 9:48
shabonaa10-Jan-06 9:48 
QuestionReadonly property on PropertyGrid Pin
Luis Barreira10-Jan-06 8:06
Luis Barreira10-Jan-06 8:06 
I hava a situation where I have a class that contains objects os other classes that are to be readonly (the whole thing is initialized in the constructor, and the gris is used only to show the results).

The problem is that the TypeConverters for some of the inner objects are allowing to edit the object:

using System;
using System.ComponentModel;

namespace PropertyTest
{
public class SimpleClass
{
private NestedClass _xy;
private int _z;

public NestedClass XY
{
get { return _xy; }
}

public int Z
{
get { return _z; }
}

public SimpleClass()
{
_xy = new NestedClass(1, 2);
_z = 3;
}
}

[TypeConverter(typeof(NestedClassConverter))]
public class NestedClass
{
private int _x;
private int _y;

public int X
{
get { return _x; }
set { _x = value; }
}

public int Y
{
get { return _y; }
set { _y = value; }
}

public NestedClass(int x, int y)
{
_x = x;
_y = y;
}
}

public class NestedClassConverter : ExpandableObjectConverter
{
public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
{
if (destinationType == typeof(NestedClass))
return true;

return base.CanConvertTo(context, destinationType);
}

public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
{
if (destinationType == typeof(System.String) && value is NestedClass)
{
NestedClass nc = (NestedClass)value;

return nc.X.ToString() + "," + nc.Y.ToString();
}
return base.ConvertTo(context, culture, value, destinationType);
}
}
}

If I create an object of type SimpleClass, I want the property of type NestedClass to be readonly on the propertygrid. How can I do that?

Luis Barreira
AnswerRe: Readonly property on PropertyGrid Pin
leppie10-Jan-06 19:08
leppie10-Jan-06 19:08 
GeneralRe: Readonly property on PropertyGrid Pin
Luis Barreira10-Jan-06 23:34
Luis Barreira10-Jan-06 23:34 
GeneralRe: Readonly property on PropertyGrid Pin
leppie10-Jan-06 23:42
leppie10-Jan-06 23:42 
QuestionLose db connection after setup???? Pin
Small Rat10-Jan-06 7:17
Small Rat10-Jan-06 7:17 
AnswerRe: Lose db connection after setup???? Pin
Guffa10-Jan-06 7:31
Guffa10-Jan-06 7:31 
GeneralRe: Lose db connection after setup???? Pin
Small Rat10-Jan-06 7:38
Small Rat10-Jan-06 7:38 
GeneralRe: Lose db connection after setup???? Pin
Dave Kreskowiak10-Jan-06 9:10
mveDave Kreskowiak10-Jan-06 9:10 
AnswerRe: Lose db connection after setup???? Pin
Guffa10-Jan-06 20:59
Guffa10-Jan-06 20:59 
GeneralRe: Lose db connection after setup???? Pin
Small Rat11-Jan-06 16:46
Small Rat11-Jan-06 16:46 
QuestionCom+ NetBios problem Pin
webhay10-Jan-06 6:52
webhay10-Jan-06 6:52 
QuestionProblem connection string Sybase C# Pin
coloso10-Jan-06 6:47
coloso10-Jan-06 6:47 
AnswerRe: Problem connection string Sybase C# Pin
Guffa10-Jan-06 6:54
Guffa10-Jan-06 6:54 
QuestionSee webcam from another PC Pin
Daniel Santillanes10-Jan-06 5:11
professionalDaniel Santillanes10-Jan-06 5:11 
AnswerRe: See webcam from another PC Pin
Curtis Schlak.10-Jan-06 5:43
Curtis Schlak.10-Jan-06 5:43 
QuestionSynchronization Pin
rakesh_nits10-Jan-06 4:41
rakesh_nits10-Jan-06 4:41 
AnswerRe: Synchronization Pin
Curtis Schlak.10-Jan-06 4:49
Curtis Schlak.10-Jan-06 4:49 
QuestionButton event Pin
Kola Sokol10-Jan-06 4:40
Kola Sokol10-Jan-06 4:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.