Friends,
I have tried to find some information about my problem BUT i can't.
I have one DataGrid (Windows Forms) that uses for the database one
(SortedList - HashTable)
SortedList h = DataBase.FillShortList(); // Fill my SortList "Hashtable"
DataGrid.DataSource= new ArrayList(h.Values); // Convert my SortList to
ArrayList.
MY BIG PROBLEM:
When the user change one value on the DataGrid (field: Adeb or Acred) I what
to UPDATE my SortedList - HashTable !!
I what to:
1 - Bind the SortList to the DataGrid ( ok, done)
2 - User update the field (field: Adeb or Acred) in DATAGRID (windows forms):
2.1 - Update the SortList
3 - Refresh the DataGrid
How to do the step 2.1 ???
How to update my SortedList (HashTable) when the user updates the DataGrid
(field: Adeb or Acred) ???
More details:
I have one DataGrid (Windows Forms) that use one ArrayList for the DataSource
SortedList h = DataBase.FillShortList(); // Fill my SortList "Hashtable"
DataGrid.DataSource= new ArrayList(h.Values); // Convert my SortList to
ArrayList.
The FillShortList() Function is responsable to fill my SortList "Hashtable":
{
....
SortedList h = new SortedList();
Data d = new Data(); // Uses custom class
d.NumConta=Convert.ToString(result["NumConta"]).Trim();
d.Adeb=Convert.ToDouble(result["Adeb"]);
d.Acred=Convert.ToDouble(result["Acred"]);
h.Add(Convert.ToString(result["NumConta"]).Trim(),d); // My SortedList uses
the numConta for the Key
return h;
}
[Custom Class]
public class Data
{
private string numConta = "";
private double adeb = 0;
private double acred = 0;
public string NumConta
{
get
{
return numConta;
}
set
{
numConta = value;
}
}
public double Adeb
{
get
{
return adeb;
}
set
{
adeb = Math.Round(value,0);
}
}
public double Acred
{
get
{
return acred;
}
set
{
acred = Math.Round(value,0);
}
}
}
Best Regards,
Ricardo Figueira
http://rbfigueira.net