Click here to Skip to main content
15,908,264 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I use VS2010 "Windows Forms Control Libray" to create user control, but i'm in troubles, i can't input any value to control attribute. the sample code as follow:
C#
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ChartTest
{
    public partial class UserControl1 : UserControl
    {
        public UserControl1()
        {
            InitializeComponent();
        }

        public class CMyClass
        {
            private int x;
            private int y;

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

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

        private CMyClass mc = new CMyClass();

        public CMyClass MC
        {
            set
            {
                mc = value;
            }
            get
            {
                return mc;
            }
        }
    }
}


i can set focus to control attribute editor, but i can't to input any value. i'm a newcomes, can you guide me to solve this question? thanks a lot.
Posted
Comments
Joan Magnet 27-Mar-15 10:12am    
Have you tried to declare CMyClass outside of UserControl1?
Member 11560490 27-Mar-15 10:18am    
yeah. maybe i need to write an type convertor? thanks for your help.
Maciej Los 27-Mar-15 14:52pm    
https://msdn.microsoft.com/en-us/library/02a1w7dy%28v=vs.85%29.aspx
Member 11560490 28-Mar-15 0:44am    
i can't imitation this code. because microsoft have write "Color" class and "ColorConverter" class. So i need an type converter to finish data type convert. how to write converter? i unable to see the source code for "ColorConverter". do you see what i mean? thank you very much.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900