|
-
Jul 27th, 2005, 08:12 AM
#1
Thread Starter
Lively Member
Listview problem
I am using this code:
VB Code:
Dim fileUsers As New IO.StreamReader("file.csv")
Dim lineUsers As String()
While fileUsers.Peek() <> -1
lineUsers = fileUsers.ReadLine().Split(",")
ListView1.Items.Add(lineUsers(0))
End While
Now this works fine, except it loads the data into a very short column instead of the full way accross. How can I overcome this?
Cheers.
-
Jul 27th, 2005, 01:38 PM
#2
Fanatic Member
Re: Listview problem
You need to adjust the width of the appropriate column. Check out the properties of the listview theres a Collums property, click the thingy and you can add and modify them.
"so just keep in mind that fantasy is not the same as realtiy and make sure u remember that wii sports may be fun but u cant count on it as exercise ok cool bye" - HungarianHuman
-
Jul 27th, 2005, 01:56 PM
#3
Hyperactive Member
Re: Listview problem
in your form load event
VB Code:
listview1.Columns(0).Width = -1
-1 sets it to the widest data item
--"Tap Dancing On The Brittle Edge Of Sanity"--
-
Jul 27th, 2005, 01:59 PM
#4
Fanatic Member
Re: Listview problem
 Originally Posted by DirtyHowi
in your form load event
VB Code:
listview1.Columns(0).Width = -1
-1 sets it to the widest data item
Damn that's good to know.
"so just keep in mind that fantasy is not the same as realtiy and make sure u remember that wii sports may be fun but u cant count on it as exercise ok cool bye" - HungarianHuman
-
Jul 28th, 2005, 02:48 AM
#5
Thread Starter
Lively Member
Re: Listview problem
Tried both of those, tried setting the width in both code and in the column properties to -1 and to 240 (the width of the ListView item), and it still for some reason displays a little bit accross the way...
Also for some reason it doesn't show the column heading I have set
-
Jul 28th, 2005, 03:07 AM
#6
Re: Listview problem
it seems that you are putting the data in the first column
try this one
VB Code:
'assuming that the firstcolumn name of your listview is columnheader1
'form load event
this.columnheader1.width=listview1.width-20
-
Jul 28th, 2005, 03:28 AM
#7
Thread Starter
Lively Member
Re: Listview problem
OK, I found the problem to be with me having
ListView1.View = Large
instead of
ListView1.View = Details
But now what happens is that I have made 3 columns, the first one has disappeared off to the left when the width properties says it should not...
Is there any possible reason why the left colum would disappear?
Cheers.
-
Jul 28th, 2005, 07:05 AM
#8
Hyperactive Member
Re: Listview problem
if you set listview.columns(0).width=-1 it makes that column the width of the widest item, pushing the other columns off to the right. (you said left...which i dont understand, maybe you can enlighten me...never seen that happen before, course never seen a ghost either.) i had the same problem, cept i was only using column(0).
you can also set the width this way.
in form load
listview1.Columns.Add("", 300, HorizontalAlignment.Center)
change 300 to whatever you want...i was only using one column, so i set it to the width of the control on the screen
--"Tap Dancing On The Brittle Edge Of Sanity"--
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
|