Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  HOME    TRACKER    Visual Basic

How Can I Insert A Line In A ListView ?

How can I insert a line in a ListView ?

Is it possible to make it without shift all the lines after where I would like to insert the new line ?
By using SendMessage ?


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Insert Line In RTB
I've searched the Forum and there's a lot of info on inserting lines of text but none that do what I need. Perhaps someone knows how.

I'm loading an .htm file in a RichTextBox. What I want to do is insert MyString on it's own line just before the <Title> tag like this:


Not like this:

Anyone know how? Thanks!

Insert Line In Next Available Cell

I have now tried a million things without result so I really hope someone can help me.

My roadmap is split into four quarters; "Qu1","Qu2","Qu3" and "Qu4". I need excel to find for example "Qu4" (which moves as I delete/insert lines - so it has to search the content of the cell) then find the next available cell under it and then insert a new line.

Does anyone have an idea?

Thanx in advance,

Insert Line Like An Object
i´ve read how to draw a line in a form with the finction Line, but i´m looking to insert an object line , like i do in ms office.
do someone know where i can find a drawing toolbar?

thanks all
greetigs from argentina


HoW To Insert A Line At Run Time??

i have a problem here in my program..
i need to insert a line (and deal with it as an object) at the run time by clicking on a command button for example..

and at every time the user click on the command button, a line appears in my form.. its parameter is taken from text boxes in other form(x1,x2,y1,y2)...

in other word:
how to insert an infinete number of control boxes(a line
for example) to my form at run time by the user..??

i know it is a hard problem but please help???
i need it for my project!!

Insert New Line In Text Box
Is there any way to force a new line in the text box? I tried using 'Chr(13)' but all it did was put in a black box ! Please help!

HoW To Insert A Line At Run Time??

i have a problem here in my program..
i need to insert a line (and deal with it as an object) at the run time by clicking on a command button for example..

and at every time the user click on the command button, a line appears in my form.. its parameter is taken from text boxes in other form(x1,x2,y1,y2)...

in other word:
how to insert an infinete number of control boxes(a line
for example) to my form at run time by the user..??

i know it is a hard problem but please help???
i need it for my project!!

How To Insert Line In Excel Using VBA
I want to place a horizontal line in Excel using VBA.Actually iam working with Excel object in VB.Iam able to insert a vertical line with some code but with other options iam not able to insert horizontal line.Can anyone please help me out with this.
Here is the code for the vertical line

Worksheets("Sheet1").Range("A1:G1").Borders(xlDiagonalUp).Color = RGB(255, 195, 0)

Also i want to insert page numbers in the footer like

Page i of n.

Using VBA can anyone tell me as what code to write to display the page numbers.

I will be very much thankful to you if you can give solution to these.



How To Insert A Line In Word?
Hi All,
Please solve the following problem for me.

I want to insert a new picture of line in my word document through word. how can i do that ??
is it possible for me to format the content of the data as follows??
name : Ramanjaneyulu Narra
father's name : Hanumantha Rao
address : Inida
__________________________________________________(this is the line picture i want to insert)
Education : B.Tech
Branch :CSE
Year of Passing :2005

when i tried to do this using the spaces i was not able to do it completely.

Please solve the above 2 probelms for me as soon as possible.
I will be greatful to all those who responds to this mail.

Ramanjaneyulu Narra

Insert A Line Break
Hi All,

I am trying to make a string formula to be used in my report. This contains of a client's address. This address field has 2 fields that i need to use.

This is how i am making the formula:

Code:Shared StringVar textAddress;
        textAddress:=textAddress + ', ' + {QRY_MORTCASEPROGRESS.PROPERTYADDESSLINE2};

in the second line instead of " + ', ' + " I want to insert a break in line. Something like vb's vbcrlf .

Can someone tell me how to go about it?


ListView - Reading Line By Line
can anyone help me please, I'd like to be able to read a populated Listview box line by line, I know it's possible but I can's seem to remember how to do it

I Cannot Find The Problem With This INSERT INTO Line...
Set recordset1 = database1.Execute("INSERT INTO clips(Name, Size, Format, Source, Filename) VALUES('" & strname1 & "', '" & strsize1 & "', '" & strformat1 & "', '" & strsource1 & "', '" & strfilename1 & "')")
all of the variables are strings.. and all the names match exactly to the database.. am i missing something small?

How To Insert Bar(line) In Rich Text Box
please help me how to insert bar in the rich text box
thank you

Modify And Insert Line In Listbox
I don't know if this is possible but I'm trying to modify all existing entries in a Listbox and add them after each entry.

So if I have these entries:

It would modify and add after each entry and the results would be this:

If anyone can help, thanks

How Can I Insert A Letter Or Character At End Of Each Line.
can some one please help me?

I have a bunch of text files that I am trying to clean up junk out of. I have found a script that will remove any line that has a certain word, i am looking for a script to remove specific text out of single or a bunch of text files. i am also looking for a script that I can enter any character at the end of each line in a text file.

I am VERY new to scripting and programming, so take it easy on me.

thank you in advance for your help

Matching Line In 2 Sheet And Insert In Other...


RATE and SERVIZIO have a unique index into column AC to identify a line.


If a line in RATE, indentified with index AC, not is present into SERVIZIO with the same index, delete the line from RATE and insert into DEFINITE
Matching for entire range of line
this for all line...

Insert The Horizontal Line In A Popup Menu
I’m trying to figure out how to insert the horizontal line in a popup menu (like when your in your browser and click on Tools. The line between Windows Update and Messenger) and how to underscore the alt commands.

Thanks All,

How To Insert Text At Given Column And Line Number?

I my cursor is at line 7 , and text1.selstart = 77, I have blank line at 6 and then text line at 5...... I want to insert some text exactly above the line7 at same selstart. How can I do that?
I did as follows
I got Col and line from Sendmessage API and now I want to insert my text string at that point? how can I do that?

j = CurrentColumn(box)
i = GetTextboxLine(box)
textbox1.SelStart = x - 40

box.SelText = "sfsdfsf"

I tried random number mine from old X. but its not solution.

Please help


VBScript - Insert Text At Beginning Of Each Line
I have a file with the following example data


I would like to be able to insert "02," at the beginning of each line. Is this possible and if so, can some example code please be provided?

Insert Mark Of The Web Into First Line Of HTML Pages
Hey there, I have several hundred HTML pages that need to have the MOTW code inserted into the first line of the HTML page. So far I haven't been able to do that successfully. Any suggestions?
Here's the code I'm using now:

Code:Const str = "<!-- saved from url=(0014)about:internet -->"
Set objFSO = CreateObject("Scripting.FileSystemObject")
strComputer = "."
Set objWMIService = GetObject("winmgmts:\" & strComputer & "
Set colFiles = objWMIService.ExecQuery _
    ("ASSOCIATORS OF {Win32_Directory.Name='<YOUR PATH HERE>'} Where " _
        & "ResultClass = CIM_DataFile")
For Each objLogFile In colFiles
    If objLogFile.Extension = "html" Then
        strFile = objLogFile.Name
        Set objFile = objFSO.OpenTextFile(strFile, 1)
        line = objFile.readLine
        If InStr(str, line) = 0 Then
         Set objFile = objFSO.OpenTextFile(strFile, 1)
         text = objFile.readAll
         Set objFile = objFSO.OpenTextFile(strFile, 2)
         objFile.Write str & VbCrLf & text
        End If
      End If
MsgBox "Done"

The bolded line is where it keeps ending due to error. I'm not sure how to get around this problem.

Word Automation - How To Insert A Line Break?
I am using Word Automation to create a Word document on the fly.
I do this by using a Word template and replacing keywords with text from my VB6 app.

Dear [customer],

My app replaces [customer] with the actual name and it becomes:

Dear Mr Smith,

This works fine but I have a need to replace some of the keywords with multi-line text.
Again, this works ok in the body of the document by simply using vbCr's for line breaks.
My problem is that if I use a vbCr in a Word Table, it interprets the vbCr as an unprintable character and displays an empty square character!

Does anyone know a way round this?!

My customer doesn't like having continous text and I don't particularly want to have to lose the table.



Insert Row In Listview
hi how can i insert a row in a listview?





c----> inserted row!!!


** RESOLVED ** Insert Blank Line In Middle Of Flexgrid ?
If yuo read thru a flexgrid, line by line, is it possible on change of text in column 0 to add ablank line at that point, rather than at the end of the flexgrid ?

For example ....

I have :


...... and I want it to be :



Is it possible to add lines in the middle of a populated flexgrid ? or am I stuffed ?

Insert New Line In Tab Dialog Control Caption (unresolved)
How can I split the caption for a tab in the Microsoft Tab Dialog Control (SSTab1)? I want to have a tab's caption on two seperate lines but when I put
sstab1.TabCaption(0) = "Hello" & vbnewline & "you"

Instead of a new line being put in the tab's caption, the vbnewline ASCII character is returned // and the caption becomes "Hello//you"

Is there any way around this? I'm thinking there isn't, but you never know!

Edited by - Marce22 on 5/2/2005 10:49:58 AM

How To Insert A New Line Into An Alphabetically Ordered Text File
Hi there,

I have an access database (2000) and one of the functionalities I must provide is to allow a user to insert a line into a text file that is alphabetically ordered. I have many, many cfg (text) files that contain information on each line in alphabetical order. At times, I need to insert an additional line to these files, but they must remain in alpabetical order. I am trying to figure out the best way to do it, and am wondering if this would work:

1. Open the .cfg file for input
2. read each line and insert it into a temporary table
3. insert my new line into the temp table as well
4. select from the table in alphabetical order and re-write each line in the file

So this is where I'm stuck... I'm not sure how to do this. I know I can have a SELECT statement ordered alphabetically, but I'm not sure how to take each item returned from the select statement and write it to the file...

I really hope this makes sense to someone out there!!

Thanks so much in advance if anyone has any ideas!!!

How To Insert ProgessBar Into ListView
I want to insert ProgessBar into ListView but I don't know how I do. Please show an example for me. Thanks.

Listview Insert Item Below
I did tray this

I read into listview from database

then I tray to add another item below the selected item
but the new iten go to the top,


--> the new item go on the top ?????
1 Listv
2 listv --> tray to item below thisitem
3 listv


If Not lv.SelectedItem Is Nothing Then
If lv.SelectedItem.Selected = True Then
lv.ListItems.Item(lv.SelectedItem.Index) = Text1.Text
lv.ListItems.Add lv.SelectedItem.Index + 1, , Text2.Text
MsgBox "Select an item to update."
End If
End If

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.

Help. How To Insert New Item To Listview....
I want to insert new item to listview from the beginning. It looks like new item always stay in the first line.

Please, help me....

Insert Row Into Listview Control
This post - thread222-51986 - is from February of 2001.  I only bring this up because it cost me a little time today and it might help someone else looking.

The original post asks the question:
"How do I insert into the middle of a listview control"  The answer to the post was:
"No possible way".

This is not true.  By using the index property of the control it can be done.

Example: Listview1.listitems.add, 2, "text"
Will insert into the existing rows

My question is:
As chiph is a exceptional contributor to this site, I am asking was this thread posted prior to the control having this feature?  Possibly a service pack fix?



P.S. It is good to be back.

How To Load Excel Data Into ASP Page Den Insert Each Line Into Access One By One?
how to open an existing excel file with multiple columns and rows and den insert it into ASP form den upload each record into database. Had to do it in this way cos when upload to database, it require to perform other tasks.

Or how to open an excel file and load its contents directly into an existing access table?

Please provide me the code to teach me. Thanks!

Count Number Of Lines In A Project And Insert Line Numbers
Please do not post anything if you don't want to download it.

Please test my Add-in Dll to vb which counts the number of lines, adds Line numbers to module and also removes them.
You can select which module you want to add the lines and also which modules you want to count.
Just download the dll and register.

Please post any feedback.

Thanks for testing.

PS Anyone posting REAL feedback will get the final release for free.

How To Insert A Small Picture/text Line In The Middle Of MDI Form
I want to insert a small picture or a text line in the middle of a MDI form. Can someone suggest me the way?


ListView : Programatically Insert New Column
How do i INSERT a new column before or after a specified column. (listview in report mode).

The problem is after inserting the new column, i need to go through all items and shift the subitems to the right of the new column. Is there a simpler way?

How about ADD the new column to the end of the ColumnHeaders colection, and then programatically move it to the correct spot... how do i do that. This would work as if the user dragged the last column (the new, empty one) to the right spot.

Insert A Imagecombo On A Listview Cell?
Hi everyone.

How can i insert a imagecombo control in a listview cell when a user clicks a row on the listview?


- Getting Img By Keyname From ImageList To Insert In ListView
Hi VBcitizens, I was using the Index numbers of a imagelist to put the images into a Treeview and a Listview,

now when i was updating this i wanted to use the Key names in the imagelist to call them, worked for treeview, but for the ListView it didn't seem to work,

ListView1.ListItems.Add , , Text:="Some", SmallIcon:=1

the SmallIcon:= only let me use the index numbers from the ImageList, is there a way to use the Key names here?

Edited by - T48 - [RedPlanet] on 12/21/2004 8:43:03 AM

Insert A Combobox In A Dynamic Listview As Subitem

I created a “dynamic” listview (I mean, the number of columns, the width of the ColumnHeaders depends of the code).

I use the kind of code to populate the listview

ListView1.View = lvwReport
ListView1.ColumnHeaders.Add , , "Id", 60
ListView1.ColumnHeaders.Add , , "Type", 60
ListView1.ColumnHeaders.Add , , "Link", 60
ListView1.ColumnHeaders.Add , , "Name", 100
ListView1.ColumnHeaders.Add , , "Direction", 60
cpt = 0

For intx = LBound(ArrTest) To UBound(ArrTest)
ListView1.ListItems.Add , , ArrTest(cpt).ID_TRC
ListView1.ListItems(cpt + 1).SubItems(1) = ArrTest(intx).TYPE
ListView1.ListItems(cpt + 1).SubItems(2) = ArrTest(intx).LINK
ListView1.ListItems(cpt + 1).SubItems(3) = ArrTest(intx).NAME
ListView1.ListItems(cpt + 1).SubItems(4) = ArrTest(intx).DIREC
cpt = cpt + 1
Next intx

But I can use the same listview at another place in the code with different columns and width. So, that why is a “Dynamic Listview”.

My actual problem is I want to replace (for example) the SubItems(4) by a combo box, so I can change the value of the SubItems(4) in the listview before updating the Array (ArrTest).

Anybody have an idea how to realize this things

See the attach jpeg file for an example of what I want to do

Many Thanks

Dominic Lavoie

Insert/edit/update Data To Db Using Listview Control
I have a listview control that is populated by values from the database. Is it possible to edit/update the items directly from the ListView control? And is it possible to insert new data to the db using the ListView control?


How To Retrive Items From Listview And Listbox And Use It In Insert Mysql Statment?
Hi all . I got the following sql statemnt that insert data to mysql db . Currently i have to enter artistsname and albumname manually(shown in bold beleow) but i want to collect them from listview and also get one extra item information which is from listbox(cdpic) .

I be happy if some one help me construct the correct sql by collecting correct data from listview and listbox. thanks

My current insert statement:

VB Code:
CNN.Execute "INSERT INTO songs (filename,title,artist,album) VALUES('" & path & "','" & title & "',' [b]Andy[/b]',[b]'Live concert in Germany[/b]')"

1)artist and album data ==> from first row of 3th and 4th column of listview
( 3th and 4th listview column names artistName,albumName)

2)cdpic data ======> from first row of listbox

Note: i want t add http://localhost prefix to the value of first row of listbox then use the whole value in sql statment.
cdpic = http://localhost/+ first item of listbox

create the insert statemetn just like this with bold parts those information i want to collect from listbox and listview:

VB Code:
CNN.Execute "INSERT INTO songs (filename,title,[b]artist,album,cdpic[/b]) VALUES('" & path & "','" & title & "',' [b]????[/b]','[b]?????[/b]','[b]??????[/b]')"

How To Insert/edit Data In Controls In External Apps (listview/toolbar/etc)
Anyone have any examples on how to accomplish similar tasks like setting the text of an item in a treeview or listview, or adding a button to a toolbar in external applications (and finding out when its clicked).. or perhaps getting the selected item in a listview? (All in external apps)

Deleting A Line From Listview??
I have a text file that I am pulling certain information from and displaying it in a listbox. I can remove the item from the list, but it is not reflecting the change in the original file I compiled it from. I have tried check boxes and recopying and can't seem to get the original file modified as well.

I know that the list box arrays the information, but the list index is different in the original and the posted is it not? Any help would be appreciated!

Thanks In Advance,

Showing The Last Line In A Listview Box?
I've written a program that populates a listview box, my question is, how is it possible to show the last line entered when the amount of lines exceeds the listview so that the last line is always shown?

Highlight Line In Listview
I'm trying to move down to a particular line in Listview with the following code, when I run it, it does move down the list until it gets to line 20 in this case but what I'd like it to do is highlight the line, but it doesn't work, does anyone have any idea why?

dim count4 as integer
count4 = 20
Set ListView2.SelectedItem = ListView2.ListItems(count4)
Set ListView2.SelectedItem = ListView2.ListItems(count4)

Remove Line Listview
Hello, how can i remove a selected line in a listview. I have 2 columns, A and B and when i select something in the listbox and i double click it, it removes the entire line from A to B, how can i do this?

Blank Line In Listview
when filling a listview from a file i always get an empty line in the listview?

Vertical Line In ListView!
I am using a ListView whose View is set to 2 - lvwList. I want to add a vertical line in between the different columns so that they can be easily differentiated from each other. Presently the ListView looks like image 1 shown below but I want it to look like image 2. How do I do this?

Checking the Gridlines checkbox doesn't make any difference.

Listview, Hit Enter, Go To Next Line
I need to make my listview so that when a user is typing into it, they go to the next line and can automatically start typing in it. How do I do this?

Right now if the Listview Click event handler has the .StartLabelEdit active.

ListView Select Line
How can i select a line ?

I want it like if i was pressed the mouse on a line I do not want to have the line selected with :

VB Code:
Set ListView1.SelectedItem = ListView1.ListItems(2)ListView1.ListItems(2).Selected = True

ListView : Columns And Line
Hi everyone,
If I click in a raw of a ListView, I can know its raw number (item). How can I know its column position (sub-item) of this raw ?



Mikael Person

How To Disable Line...and...color...listview
i use a listview with checkboxes and with the option that selects the hall line...not just the first

how i can disable a listview line when is checked? so it can not be checked again...and how i can color the line that is checked from black to red?

i use listview1.selecteditem.forecolor to change the color but it changes only the first column not the others...

Copyright © 2005-08, All rights reserved