|
-
Oct 7th, 2002, 01:59 AM
#1
Thread Starter
Hyperactive Member
Listview Insert/Remove
What it the call to insert a blank line in a Listview.
Is it add or what
I think Listview.Remove K will take out a line where you want.
-
Oct 7th, 2002, 02:04 AM
#2
Need-a-life Member
VB Code:
ListView1.ListItems.Add ,"BlankItem", ""
Emiliano F. Martín
If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
-
Oct 7th, 2002, 02:17 AM
#3
Thread Starter
Hyperactive Member
-
Oct 7th, 2002, 03:23 AM
#4
Frenzied Member
-
Oct 7th, 2002, 06:34 AM
#5
Thread Starter
Hyperactive Member
List view
That will not add a line to listview
What I would like to do is select the spot where I wish to add a line.
Been looking and found nothing.
In Dos it would look something like THis
Where Eform is form name
Inkey_Text(1) is the editor for lables I use
Inkey(Line_num)=is the Label where the Info is Displayed
Pages(x,x) it the data array
Sub Do_AltI() ' Insert A Line
Eform.Inkey_Text(1).Text = Space$(Len(Inkey(Line_Num)))
XX = 24
Do Until XX = Row
Page_s(XX, 1) = Page_s((XX - 1), 1)
Page_s(XX, 2) = Page_s((XX - 1), 2)
Paged(XX, 1) = Paged((XX - 1), 1)
Paged(XX, 2) = Paged((XX - 1), 2)
Paged(XX, 3) = Paged((XX - 1), 3)
Paged(XX, 4) = Paged((XX - 1), 4)
XX = XX - 1
Loop
Page_s(Row, 1) = 0
Page_s(Row, 2) = 0
Paged(Row, 1) = ""
Paged(Row, 2) = ""
Paged(Row, 3) = ""
Paged(Row, 4) = ""
Txs(Row) = 0
Stc(Row) = 0
Reprint
End Sub
Now I could do this to the information in the listview but i know there must be a better way.
Last edited by Dbee; Oct 7th, 2002 at 07:11 AM.
Don
(OLD DOS Programmer)
-
Oct 7th, 2002, 07:03 AM
#6
Fanatic Member
not sure if there's a better way, but try this out:
VB Code:
Private Sub Command1_Click()
Dim i As Integer
Dim intNewItemPos As Integer
Dim itemx As ListItem
intNewItemPos = 3
Set itemx = ListView1.ListItems.Add(, , "Bleh10")
For i = intNewItemPos To ListView1.ListItems.Count - 1
Set itemx = ListView1.ListItems.Add(, , ListView1.ListItems(intNewItemPos).Text)
ListView1.ListItems.Remove (intNewItemPos)
Next i
End Sub
Private Sub Form_Load()
Dim itemx As ListItem
Set itemx = ListView1.ListItems.Add(, , "Blah1")
Set itemx = ListView1.ListItems.Add(, , "Blah2")
Set itemx = ListView1.ListItems.Add(, , "Blah3")
Set itemx = ListView1.ListItems.Add(, , "Blah4")
Set itemx = ListView1.ListItems.Add(, , "Blah5")
Set itemx = ListView1.ListItems.Add(, , "Blah6")
Set itemx = ListView1.ListItems.Add(, , "Blah7")
End Sub
where intNewItemPos is the point you want to insert the new item.
Last edited by tr0n; Oct 7th, 2002 at 07:07 AM.
-
Oct 7th, 2002, 07:27 AM
#7
Fanatic Member
did i misunderstand you? do you want to insert a new listitem at a certain position rather than at the bottom? that's what my code will do. otherwise, i don't understand what you want.
-
Oct 7th, 2002, 07:30 AM
#8
Thread Starter
Hyperactive Member
listview
I tryed you code its fine, but to determain the postion of the insert is a pain.
Yes that is what i am trying to do. The dos routine take the data and does a insert or delete. Then you have to repost it to the screen.
-
Oct 7th, 2002, 07:31 AM
#9
Fanatic Member
to get the item position, use this:
VB Code:
intNewItemPos = ListView1.SelectedItem.Index
-
Oct 7th, 2002, 07:44 AM
#10
Thread Starter
Hyperactive Member
List view
Prior to me trying to do listview
I had to create a form with say 8 columns and 24 items
by placeing 192 Labels on the form. and then using the array placing data in the form that way.
Like I said it was the old DOS way of doing things.
Conversion to VB is a learing experince for an old fart.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|