Hi guys,
I have 2 questions regarding this issue:
1st. Why this code gives me the lenght of the string instead the string
itself?
Dim a As New ArrayList
a.Add(DirectCast(LProb_DataPassivos.Value.ToShortDateString, String))
a.Add(DirectCast(LProb_DescricaoPassivos.Text, String))
dgListaProblemasPassivos.DataSource = a
2nd. Why VS gives me an error when doing this, saying that I have to use
the NEW key:
user.arrayList_pass.Add(DirectCast(LProb_DataPassivos.Value.ToShortDateString,
String))
user.arrayList_pass.Add(DirectCast(LProb_DescricaoPassivos.Text, String))
dgPass.DataSource = user.arrayList_pass
I can't use the NEW because user.arrayList_pass is a ArrayList property
from my Class and it ould reach this point with data on the ArrayList, so I
can't have a new one, I will loose every previous data.

Signature
Bruno Alexandre
(Sintra, PORTUGAL)
Bart Mermuys - 15 Nov 2005 14:02 GMT
Hi,
> Hi guys,
>
[quoted text clipped - 7 lines]
> a.Add(DirectCast(LProb_DescricaoPassivos.Text, String))
> dgListaProblemasPassivos.DataSource = a
Because a DataGridView can have multiple columns and when you bind an object
then the names of the properties are used for the column headers and the
values for the cells in a row. A string is an object with one property
Length.
If you only have one column, you could consider using a simple ListBox,
otherwise you will need to either create your own class with a single
property that returns a string or use a DataTable with a single Column.
If you're using .NET2.0 it's also better to use a generic BindingList<Of T>
instead of ArrayList.
Can't help you with the second problem.
HTH,
Greetings
> 2nd. Why VS gives me an error when doing this, saying that I have to
> use the NEW key:
[quoted text clipped - 7 lines]
> from my Class and it ould reach this point with data on the ArrayList, so
> I can't have a new one, I will loose every previous data.
Bruno Alexandre - 15 Nov 2005 14:37 GMT
I change it to DataTable instead ArrayList
:-)

Signature
Bruno Alexandre
(Sintra, PORTUGAL)
> Hi guys,
>
[quoted text clipped - 19 lines]
> from my Class and it ould reach this point with data on the ArrayList, so
> I can't have a new one, I will loose every previous data.