#88978 - 2002-10-26 11:23 PM
Re: KixForms: How do you delete a column
|
krabourn
Hey THIS is FUN
Registered: 2000-12-11
Posts: 244
Loc: San Antonio, Texas, USA
|
Thanks!
Is there a way to add a bunch of items at once without looping through an array? I remember reading talk about it but I have not been able to. Is this in tonight's hopefull release?
Current example:
code:
IF Open (10, $FileComputerList, 2) = 0 $TempComputerList = '' $LineComputerList = ReadLine (10) WHILE @error = 0 $TempComputerList = $TempComputerList + $LineComputerList + ',' $LineComputerList = ReadLine (10) LOOP $RC = Close (10) $ArrComputerList = Split (SubStr ($TempComputerList, 1, Len ($TempComputerList) - 1), ',', -1) FOR EACH $Computer IN $ArrComputerList $Item = $List.Items.Add $Item.Text = $Computer NEXT ENDIF
_________________________
Kelly
|
Top
|
|
|
|
#88979 - 2002-10-26 11:38 PM
Re: KixForms: How do you delete a column
|
Shawn
Administrator
Registered: 1999-08-13
Posts: 8611
|
Yeah, that isn't in there yet mostly because I haven't figured out what the correct syntax should be ... are you meaning something like what you can do with the listbox object:
$ListBox.List = 1,2,3,4,5,6
If yes, yeah - I haven't nailed down the syntax for ListView yet, maybe like
$ListView.Items = 1,2,3,4,5,6
Is this what your meaning ?
-Shawn
[ps] Just as an FYI, one might ask themselves why there are two methods for deleting columns (or items), the first example above:
$ListView.Columns.Remove(n)
asks the Columns collection to delete a particular column from its collection, the second example:
$ListView.Columns(n).Remove
asks a particular column to remove ITSELF from the collection - subtle difference but same effect.
|
Top
|
|
|
|
#88983 - 2002-10-27 12:37 AM
Re: KixForms: How do you delete a column
|
Shawn
Administrator
Registered: 1999-08-13
Posts: 8611
|
You mean like this ?
code:
$List.Columns.Count = 3 $List.Items.Count = 10 For Each $Item in $List.Items $Item.Text = "krabourn" $Item.SubItems(1).Text = "was" $Item.SubItems(2).Text = "here" Next
? [ 27. October 2002, 00:38: Message edited by: Shawn ]
|
Top
|
|
|
|
#88984 - 2002-10-27 04:33 AM
Re: KixForms: How do you delete a column
|
krabourn
Hey THIS is FUN
Registered: 2000-12-11
Posts: 244
Loc: San Antonio, Texas, USA
|
I don't have much experience with Multi-Dimensional arrays. The following is for a single dimension array. Creating all the items first seems to run faster than looping and creating them one by one.
I am just not sure, yet, how I am going to read a file and add the info to a multi-dimensional array, which would be the ListView. Sometimes things have to ramble in my head for a day or two.
code:
IF Open (10, $FileComputerList, 2) = 0 $TempComputerList = '' $LineComputerList = ReadLine (10) WHILE @error = 0 $TempComputerList = $TempComputerList + $LineComputerList + ',' $LineComputerList = ReadLine (10) LOOP $RC = Close (10) $ArrComputerList = Split (SubStr ($TempComputerList, 1, Len ($TempComputerList) - 1), ',', -1) $List.Items.Count = Val (UBound ($ArrComputerList) + 1) FOR $Index = 0 TO Val (UBound ($ArrComputerList)) $List.Items($Index).SubItems(0).Text = $ArrComputerList[$Index] NEXT ; FOR EACH $Computer IN $ArrComputerList ; $Item = $List.Items.Add ; $Item.Text = $Computer ; NEXT ENDIF
_________________________
Kelly
|
Top
|
|
|
|
Moderator: Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart
|
0 registered
and 259 anonymous users online.
|
|
|