Home » U++ Library support » ArrayCtrl, HeaderCtrl & GridCtrl » Two "basic" operations on GridCtrl
Re: Two "basic" operations on GridCtrl [message #21126 is a reply to message #21125] |
Mon, 04 May 2009 13:37   |
|
So if you know data types from the input - just convert strings to Upp types before adding them to the grid. Like this:
FileIn f("data.csv");
int row = 0;
while(!f.IsEof())
{
Vector<String> v = Split(f.GetLine(), ';');
for(int i = 0; i < v.GetCount(); i++)
{
Value val;
if(i == 0) // date
{
val = Date(v[i].Left(4), v[i].Mid(5, 2), v[i].Right(2));
}
else if(i == 1) // double
{
val = StrDbl(v[i]);
}
else if(i == 2) // int
{
val = StrInt(v[i]);
}
else // any other type
val = AsString(v[i]);
grid.Set(row, i, val);
}
++row;
}
[Updated on: Mon, 04 May 2009 13:39] Report message to a moderator
|
|
|
 |
|
Two "basic" operations on GridCtrl
By: kbyte on Sun, 26 April 2009 18:27
|
 |
|
Re: Two "basic" operations on GridCtrl
By: unodgs on Sun, 26 April 2009 20:46
|
 |
|
Re: Two "basic" operations on GridCtrl
By: kbyte on Sun, 26 April 2009 21:17
|
 |
|
Re: Two "basic" operations on GridCtrl
By: unodgs on Sun, 26 April 2009 21:43
|
 |
|
Re: Two "basic" operations on GridCtrl
By: kbyte on Mon, 27 April 2009 00:04
|
 |
|
Re: Two "basic" operations on GridCtrl
By: kbyte on Mon, 27 April 2009 00:35
|
 |
|
Re: Two "basic" operations on GridCtrl
By: unodgs on Mon, 27 April 2009 08:47
|
 |
|
Re: Two "basic" operations on GridCtrl
By: kbyte on Sat, 02 May 2009 12:14
|
 |
|
Re: Two "basic" operations on GridCtrl
By: unodgs on Mon, 04 May 2009 09:39
|
 |
|
Re: Two "basic" operations on GridCtrl
By: kbyte on Mon, 04 May 2009 12:52
|
 |
|
Re: Two "basic" operations on GridCtrl
By: unodgs on Mon, 04 May 2009 13:37
|
 |
|
Re: Two "basic" operations on GridCtrl
By: kbyte on Mon, 04 May 2009 14:02
|
 |
|
Re: Two "basic" operations on GridCtrl
By: unodgs on Mon, 04 May 2009 15:22
|
 |
|
Re: Two "basic" operations on GridCtrl
By: kbyte on Mon, 04 May 2009 15:52
|
 |
|
Re: Two "basic" operations on GridCtrl
|
Goto Forum:
Current Time: Fri Jul 18 07:33:08 CEST 2025
Total time taken to generate the page: 0.00914 seconds
|