Te pasan una clase que se llama Nombre:
Código:
using System.ComponentModel;
using System.Data;
using System.Windows.Forms;
using System.Collections;
using System.Drawing;
using System.Drawing.Design;
using System.Drawing.Drawing2D;
using System.Drawing.Text;
using Agenda;
namespace TAREA_06
{
public class Entrada
{
private string nombre = "";
private string apellido = "";
private string telefono = "";
private string cedula = "";
private string direccion = "";
private long id = 0;
Editor ent = new Editor();
public string Nombre
{
get
{
return this.nombre;
}
}
public string Apellido
{
get
{
return this.apellido;
}
}
public string Telefono
{
get
{
return this.telefono;
}
}
public string Direccion
{
get
{
return this.direccion;
}
}
public string Cedula
{
get
{
return this.cedula;
}
}
public long Id
{
get
{
return this.id;
}
}
public string Titulo
{
get
{
return this.ToString();
}
}
public Entrada(Editor vent, string nom, string ape, string tel, string dir, string rut)
{
this.id = vent.Cuenta;
this.nombre = nom;
this.apellido = ape;
this.telefono = tel;
this.cedula = rut;
this.direccion = dir;
}
public Entrada(Editor ent)
{
this.id = ent.Id;
this.nombre = ent.Nombre;
this.apellido = ent.Apellido;
this.telefono = ent.Telefono;
this.cedula = ent.Cedula;
this.direccion = ent.Direccion;
}
public static bool operator !=(Entrada a, Entrada b)
{
return (a == b) == false;
}
public static bool operator ==(Entrada a, Entrada b)
{
if ((object)a == null && (object)b == null)
{
return true;
}
else if ((object)a == null)
{
return false;
}
else if ((object)b == null)
{
return false;
}
else if (a.GetType().ToString() == b.GetType().ToString())
{
if (a.Apellido == b.Apellido && a.Nombre == b.Nombre && a.Telefono == b.Telefono && a.Direccion == b.Direccion && a.Cedula == b.Cedula && a.Id == b.Id)
{
return true;
}
else
{
return false;
}
}
else
{
return false;
}
}
public override bool Equals(object obj)
{
return base.Equals(obj);
}
public override int GetHashCode()
{
return base.GetHashCode();
}
public override string ToString()
{
return this.Apellido.ToUpper() + ", " + this.Nombre + ", RUT:" + this.Cedula;
}
}
}
Hay algunas cosas por ahi que no entiendo para que las quieren... pero bueno.
Hice otro formulario que le llame editor, este tiene los textbox para rellenar la informacion necesaria (nombre, apellido, bla bla)
En el form editor estaba todo bien, pero a la hora de hacer click en el boton aceptar para agregar los datos al listbox no puedo acceder :S...
Código:
private void button1_Click(object sender, EventArgs e)
{
Nombre = txtNombre;
Apellido = txtApellido;
Telefono = txtTelefono;
Direccion = txtDireccion;
Cedula = txtCedula;
Form1 form1 = new Form1();
form1.li // y acá yo queria agregar los items pero no puedo =( form1.listbox1.items.add(blabla
}