Ver Mensaje Individual
  #3 (permalink)  
Antiguo 06/08/2010, 19:46
devilguzz
 
Fecha de Ingreso: marzo-2004
Mensajes: 70
Antigüedad: 20 años, 1 mes
Puntos: 0
Respuesta: Desorden en Lista de Objetos

gracias por responder...

La estructura de la clase es la siguiente:

public class CompraDetaVO
{
private int idcompra;
private int idsede;
private int item;
private int idtipoprod;
private int cantidad;
private decimal pcompra;

private string tipoproducto;
private decimal pventa;


public int Idcompra
{
get { return idcompra; }
set { idcompra = value; }
}
public int Idsede
{
get { return idsede; }
set { idsede = value; }
}
public int Item
{
get { return item; }
set { item = value; }
}
public int Idtipoprod
{
get { return idtipoprod; }
set { idtipoprod = value; }
}
public int Cantidad
{
get { return cantidad; }
set { cantidad = value; }
}
public decimal PrecioCompra
{
get { return pcompra; }
set { pcompra = value; }
}

public string Tipoproducto
{
get { return tipoproducto; }
set { tipoproducto = value; }
}
public decimal PrecioVenta
{
get { return pventa; }
set { pventa = value; }
}

public CompraDetaVO()
{
this.idcompra = -1;
this.item = -1;
}
public CompraDetaVO(int _id,int _idsede,int _item,int _idtipoprod,int _cant,decimal _pcompra,string _tipoprod,decimal _pventa)
{
this.idcompra = _id;
this.idsede = _idsede;
this.item = _item;
this.idtipoprod = _idtipoprod;
this.cantidad = _cant;
this.pcompra = _pcompra;
this.tipoproducto = _tipoprod;
this.pventa = _pventa;
}
}

luego simplemente la lleno asi:
List<CompraDetaVO> nDetalle=new List<CompraDetaVO>();
CompraDetaVO item=new CompraDetaVO(-1,1,1,1,10,25.8,"GLP 10KG",31.0);
nDetalle.Add(item);

grid.DataSource = null;
grid.DataSource = nDetalle;

asi es como lo lleno... y cuando lo muestra en el DataGridView.. en una PC sale desordenado y en la otra sale en el mismo orden de instanciacion.. ??
__________________
GuzZpaWn