1
I’d like someone to help me with a situation. Whoever has an example please answer me. I would like to create a property in a User Control object, and that in this property opened the edit box, as an example below:
Follow code from my User Control:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApp13
{
public partial class UserControl1 : UserControl
{
public UserControl1()
{
InitializeComponent();
}
// Propriedade para informar um texto fixo.
public string MyObservacao { get; set; }
}
}
Sorry, I couldn’t understand what you wanted to do.
– Leandro Angelo
In Visual Studio c# I created a User Control (Observacaogeral) a multi-line text box. In this User Control I created a Mytextinitial property where, when I put my control in the form I go in that property and put the text I want. Only in this property appears only one line for me to type and I would like my property to open the text box as in the example posted above. The native Text property opens the edit box. I wanted this to happen with my Mytextinitial property. Att. Gilberto Rezende.
– Construindo você mesmo
Evolving... when you say
Visual Studio C#
andControle de Usuário
you are actually referring to a component and you want the editing of an attribute, in the properties tab of the IDE, to present as multiline? Include component code in your question.– Leandro Angelo
Grateful. Follow code from my User Control: using System; using System.Collections.Generic; using System.Componentmodel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace Windowsformsapp13 { public partial class Usercontrol1 : Usercontrol { public Usercontrol1() { Initializecomponent(); } // Property to provide a fixed text. public string Myobservacao { get; set; } } } Att. Gilberto Rezende.
– Construindo você mesmo
use the edit option and put this information in the question
– Leandro Angelo
Add the reference to the
System.Design
in your project and the following annotation in the property where you want the editor to be multiline[Editor(typeof(MultilineStringEditor), typeof(System.Drawing.Design.UITypeEditor))]
– Leandro Angelo
Very good. Everything worked out. I am immensely grateful. Att. Gilberto Rezende.
– Construindo você mesmo