Hi,
[quoted text, click to view] "Bruno Alexandre" <bruno.news@filtrarte.com> wrote in message
news:usho$Oe6FHA.3976@TK2MSFTNGP15.phx.gbl...
> 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
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
[quoted text, click to view] >
> 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.
>
>
> --
>
>
>
> Bruno Alexandre
> (Sintra, PORTUGAL)
>
>
>
>