1
I’m trying to write in Eventargs() a Enter Event for TB1 (textbox)
This code of Form1 (in Form1.Cs), would write it normally with the help of Designer:
using System;
using System.Windows.Forms;
namespace Project1
{
// aqui seria o método para o evento Enter que eu queria, o que está abaixo representado
// para que a letra 'text' desapareça
private void TB1_Enter(object sender, EventArgs e)
{
if(TB1.Text=="Text")
{
TB1.Text="";
}
}
}
In the code below wanted to implement the event that is above. What I intended to know is if I could write the event in the file below so that it is later compiled
using System;
using.System.Windows.Forms;
using System.Runtime.InteropServices;
namespace Project1
{
[ComVisible(true)]
public class EventArgs
{
//
//Summary:
//provides a value to use with events that do not have event data
public static readonly EventArgs Empty;
//
//Summary:
//Initializes a new instance of the System.EventArgs class
public EventArgs()
{
}
}
public class Form1:Form
{
public static void Main()
{
AplicationEnableVisualStyles();
Aplication.Run(new Form1());
}
public Form1()
{
//textBox1
TextBox TB1 = new TextBox();
TB1.Location = new Point(30, 20);
TB1.Size = new Size(100, 30);
TB1.Text = "Text";
//add control to textBox
this.Controls.Add(TB1);
}
}
}
I don’t know if I’m being clear on the problem. : S
– Rodolfo Mendes