🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: pl.comp.lang.vbasic
3 messages
3 total messages Started by Maciej Tokarz Wed, 23 Jun 2010 10:07
ListView i LINQ
#104668
Author: Maciej Tokarz
Date: Wed, 23 Jun 2010 10:07
15 lines
1190 bytes
Witam,

	W poniższym kodzie podkreśla Text :(. Jest możliwy taki zapis?

Dim listItems = From fileInfo In alarmFolder.GetFiles("*.wav") _
		Let s_name = fileInfo.Name _
		Order By fileInfo.Name _
		Select New ListViewItem() _
		{Text = s_name.Substring(0, s_name.Length - 4), _
		Tag = fileInfo.FullName}


-- 
  Maciej Tokarz
  My-Poi.pl
Re: ListView i LINQ
#104669
Author: Wiktor Zychla
Date: Wed, 23 Jun 2010 12:56
24 lines
1826 bytes
> W poniższym kodzie podkreśla Text :(. Jest możliwy taki zapis?

nieznajomość składni VB.NET się kłania:

>
> Dim listItems = From fileInfo In alarmFolder.GetFiles("*.wav") _
> Let s_name = fileInfo.Name _
> Order By fileInfo.Name _

select new ListViewItem() with { .Text = ...., .Tag = .... }

http://blogs.msdn.com/b/wriju/archive/2008/02/05/vb-net-9-0-object-and-array-initializers.aspx

pozdrawiam
Wiktor Zychla

> Select New ListViewItem() _
> {Text = s_name.Substring(0, s_name.Length - 4), _
> Tag = fileInfo.FullName}
>
>
> -- 
>  Maciej Tokarz
>  My-Poi.pl 
Re: ListView i LINQ
#104670
Author: Maciej Tokarz
Date: Wed, 23 Jun 2010 13:19
20 lines
1503 bytes
W dniu 2010-06-23 14:56, Wiktor Zychla pisze:
> nieznajomość składni VB.NET się kłania:

Nie da się ukryć! Serdeczne Dzięki!

Dim listItems = From fileInfo In alarmFolder.GetFiles("*.wav") _
		Let s_name = fileInfo.Name _
		Order By fileInfo.Name _
		Select New ListViewItem() With _
		{.Text = s_name.Substring(0, s_name.LastIndexOf(".")), _
		.Tag = fileInfo.FullName}

		For Each i In listItems
			Sounds.Items.Add(i)
		Next


-- 
  Maciej Tokarz
  My-Poi.pl
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads