|
-
Oct 18th, 2000, 07:56 PM
#1
Thread Starter
Lively Member
how do i add column headings to my listview control??
i have never used this control before and would like to
view and edit data from my sql database in the listview control
please help me i have tried all sorts of ways and cannot get it to work!!
-
Oct 18th, 2000, 08:04 PM
#2
_______
<?>
goes like this:
Code:
'add columnHeaders..the width of the columns is
'the width of the ctrl / 2 by the num of headers
'
Set sColumn = Listview1.ColumnHeaders.Add(, , "Name")
Set sColumn = Listview1.ColumnHeaders.Add(, , "Phone #1")
Set sColumn = Listview1.ColumnHeaders.Add(, , "Phone #2")
'
'add some data to the listitem (sItem)
Set sItem = Listview1.ListItems.Add(, , "Kim & Deb", 1, 1)
sItem.SubItems(1) = "905-799-9415"
sItem.SubItems(2) = "who knows"
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Oct 18th, 2000, 08:05 PM
#3
' Create an object variable for the ColumnHeader object.
Dim clmX As ColumnHeader
' Add ColumnHeaders.
Set clmX = lvFind.ColumnHeaders.Add(, , "Product", (lvFind.Width - 1066) / 2)
Set clmX = lvFind.ColumnHeaders.Add(, , "Supplier ID", (lvFind.Width - 1066) / 2)
Set clmX = lvFind.ColumnHeaders.Add(, , "Category ID", 976)
-
Oct 18th, 2000, 08:18 PM
#4
Thread Starter
Lively Member
i have tired but it does not work
i have tried both of your codes but cannot see my column headings
i know there is a property that you can select if you dont want to see the headings but
my property is set to false so you can
all i see is my control no headings????
help please
-
Oct 18th, 2000, 08:25 PM
#5
_______
<?>
Paste this code..You will see headers.I fogot a line or
two in my first post.
Code:
Option Explicit
Private Sub Form_Load()
'creat obj var for columnHeader obj and listitem obj
Dim sColumn As ColumnHeader
Dim sItem As ListItem
'
'start in report view
ListView1.View = lvwReport
'
'set the size and pos of the listview
'
ListView1.Width = ScaleWidth
ListView1.Height = ScaleHeight
ListView1.Top = ScaleTop
ListView1.Left = ScaleLeft
'
'
'add columnHeaders..the width of the columns is
'the widht of the ctrl / 2 by the num of headers
'
Set sColumn = ListView1.ColumnHeaders.Add(, , "Name")
Set sColumn = ListView1.ColumnHeaders.Add(, , "Phone #1")
Set sColumn = ListView1.ColumnHeaders.Add(, , "Phone #2")
'
'
'
End Sub
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Oct 18th, 2000, 08:28 PM
#6
Thread Starter
Lively Member
that worked great!!
one more thing i want to display and edit data from My sql in the different headings you gave me
how would i do this??
thankyou for all your help
-
Oct 18th, 2000, 08:36 PM
#7
_______
<?>
'add some data to the listitem (sItem)
Set sItem = Listview1.ListItems.Add(, , "Kim & Deb", 1, 1)
sItem.SubItems(1) = "905-799-7777"
sItem.SubItems(2) = "who knows where they live"
replace the " " fields with your variables or rs!fieldname
Set sItem = Listview1.ListItems.Add(, , data1.recordset!myField,1, 1)
or
Dim x as string
x = data1.recordset!field
Set sItem = Listview1.ListItems.Add(, , x, 1, 1)
Hope this helps...I have to go..going fishing at 4 AM.
If it doesn't drop me an email and if I get time tomorrow night I'll see if I can be of a little more help...
I'm on vacation so I can't guarantee I'll be around.
Later,
Wayne
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
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
|