|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Listbox ColumnsI'm having a really stupid problem with listboxes I have dropped a listbox on a form and I want to configure the columns I just want a single column, but it seems that another blank one is created by default to the right hand side If I set the list box as width 150 and add a column LSTProcessList.Columns.Add(New ColumnHeader) LSTProcessList.Columns(0).Text = "Ref1" LSTProcessList.Columns(0).Width = 150 Then I can grab the top of the column called Ref1, move it to the left and there is a blank one to the right. Is there any way that I can have one single column that scrolls up and down, but not left and right. thanks Andy AAJ,
A listbox has only one vertical column or one vertical row (multicolomn). Is that the problem? I hope this helps, Cor Hi Andy,
Listboxes in vb .net do not have a columns.add method. Is this a custom listbox? A listview? Bernie Yaeger "aaj" <a**@aaj.com> wrote in message news:1112107156.00d266e054768c3bdba721b5cc482828@teranews...Show quoteHide quote > Hi all > > I'm having a really stupid problem with listboxes > > I have dropped a listbox on a form and I want to configure the columns > > I just want a single column, but it seems that another blank one is > created by default to the right hand side > > If I set the list box as width 150 and add a column > > LSTProcessList.Columns.Add(New ColumnHeader) > LSTProcessList.Columns(0).Text = "Ref1" > LSTProcessList.Columns(0).Width = 150 > > Then I can grab the top of the column called Ref1, move it to the left and > there is a blank one to the right. > > Is there any way that I can have one single column that scrolls up and > down, but not left and right. > > thanks > > Andy > > > > sorry, meant list view :)
Show quoteHide quote "Bernie Yaeger" <bern***@cherwellinc.com> wrote in message news:u3v2K9GNFHA.1176@TK2MSFTNGP15.phx.gbl... > Hi Andy, > > Listboxes in vb .net do not have a columns.add method. Is this a custom > listbox? A listview? > > Bernie Yaeger > > "aaj" <a**@aaj.com> wrote in message > news:1112107156.00d266e054768c3bdba721b5cc482828@teranews... >> Hi all >> >> I'm having a really stupid problem with listboxes >> >> I have dropped a listbox on a form and I want to configure the columns >> >> I just want a single column, but it seems that another blank one is >> created by default to the right hand side >> >> If I set the list box as width 150 and add a column >> >> LSTProcessList.Columns.Add(New ColumnHeader) >> LSTProcessList.Columns(0).Text = "Ref1" >> LSTProcessList.Columns(0).Width = 150 >> >> Then I can grab the top of the column called Ref1, move it to the left >> and there is a blank one to the right. >> >> Is there any way that I can have one single column that scrolls up and >> down, but not left and right. >> >> thanks >> >> Andy >> >> >> >> > > If your question is how to make the listview size fit the data
exactly, you can do this as follows intLVWWidth = 0 <--- this will be the final width we want the listview to be once we size the columns to the data. for i = 0 to lstView.Columns.Count - 1 lstView.Columns(i).Width = -2 <--- this forces col to fit data intLVWWidth += lstView.Columns(i).Width next intLVWWidth += SystemInformation.Border3DSize.Width * 2 + SystemInformation.VerticalScrollBarWidth lstView.Width = intLVWWidth This will eliminate the space on the right and fit every thing perfectly. A refinement is to be sure that the column heading is not larger than any of the data. To do this, in the loop, you can look at the lstView.Columns(i).Width = -1 value. That sizes the column to the header. If it is greater than the data width, then use it. Thanks goes to someone on this NG for sharing this with me. I thought it was neat. Hope it is what you are looking for. John Show quoteHide quote On Tue, 29 Mar 2005 16:14:45 +0100, "aaj" <a**@aaj.com> wrote: >sorry, meant list view :) > >"Bernie Yaeger" <bern***@cherwellinc.com> wrote in message >news:u3v2K9GNFHA.1176@TK2MSFTNGP15.phx.gbl... >> Hi Andy, >> >> Listboxes in vb .net do not have a columns.add method. Is this a custom >> listbox? A listview? >> >> Bernie Yaeger >> >> "aaj" <a**@aaj.com> wrote in message >> news:1112107156.00d266e054768c3bdba721b5cc482828@teranews... >>> Hi all >>> >>> I'm having a really stupid problem with listboxes >>> >>> I have dropped a listbox on a form and I want to configure the columns >>> >>> I just want a single column, but it seems that another blank one is >>> created by default to the right hand side >>> >>> If I set the list box as width 150 and add a column >>> >>> LSTProcessList.Columns.Add(New ColumnHeader) >>> LSTProcessList.Columns(0).Text = "Ref1" >>> LSTProcessList.Columns(0).Width = 150 >>> >>> Then I can grab the top of the column called Ref1, move it to the left >>> and there is a blank one to the right. >>> >>> Is there any way that I can have one single column that scrolls up and >>> down, but not left and right. >>> >>> thanks >>> >>> Andy >>> >>> >>> >>> >> >> > Aha....credit for my last post goes to Tim Wilson on the Window Froms
Control list. Thanks Tim! John Show quoteHide quote On Tue, 29 Mar 2005 16:14:45 +0100, "aaj" <a**@aaj.com> wrote: >sorry, meant list view :) > >"Bernie Yaeger" <bern***@cherwellinc.com> wrote in message >news:u3v2K9GNFHA.1176@TK2MSFTNGP15.phx.gbl... >> Hi Andy, >> >> Listboxes in vb .net do not have a columns.add method. Is this a custom >> listbox? A listview? >> >> Bernie Yaeger >> >> "aaj" <a**@aaj.com> wrote in message >> news:1112107156.00d266e054768c3bdba721b5cc482828@teranews... >>> Hi all >>> >>> I'm having a really stupid problem with listboxes >>> >>> I have dropped a listbox on a form and I want to configure the columns >>> >>> I just want a single column, but it seems that another blank one is >>> created by default to the right hand side >>> >>> If I set the list box as width 150 and add a column >>> >>> LSTProcessList.Columns.Add(New ColumnHeader) >>> LSTProcessList.Columns(0).Text = "Ref1" >>> LSTProcessList.Columns(0).Width = 150 >>> >>> Then I can grab the top of the column called Ref1, move it to the left >>> and there is a blank one to the right. >>> >>> Is there any way that I can have one single column that scrolls up and >>> down, but not left and right. >>> >>> thanks >>> >>> Andy >>> >>> >>> >>> >> >> > Thanks to all who replied. I will give it ago today
cheers Andy Show quoteHide quote "J L" <j***@marymonte.com> wrote in message news:s2oj415e0lmek01omckhbb7nijv9n1uo1f@4ax.com... > > Aha....credit for my last post goes to Tim Wilson on the Window Froms > Control list. Thanks Tim! > > John > > On Tue, 29 Mar 2005 16:14:45 +0100, "aaj" <a**@aaj.com> wrote: > >>sorry, meant list view :) >> >>"Bernie Yaeger" <bern***@cherwellinc.com> wrote in message >>news:u3v2K9GNFHA.1176@TK2MSFTNGP15.phx.gbl... >>> Hi Andy, >>> >>> Listboxes in vb .net do not have a columns.add method. Is this a custom >>> listbox? A listview? >>> >>> Bernie Yaeger >>> >>> "aaj" <a**@aaj.com> wrote in message >>> news:1112107156.00d266e054768c3bdba721b5cc482828@teranews... >>>> Hi all >>>> >>>> I'm having a really stupid problem with listboxes >>>> >>>> I have dropped a listbox on a form and I want to configure the columns >>>> >>>> I just want a single column, but it seems that another blank one is >>>> created by default to the right hand side >>>> >>>> If I set the list box as width 150 and add a column >>>> >>>> LSTProcessList.Columns.Add(New ColumnHeader) >>>> LSTProcessList.Columns(0).Text = "Ref1" >>>> LSTProcessList.Columns(0).Width = 150 >>>> >>>> Then I can grab the top of the column called Ref1, move it to the left >>>> and there is a blank one to the right. >>>> >>>> Is there any way that I can have one single column that scrolls up and >>>> down, but not left and right. >>>> >>>> thanks >>>> >>>> Andy >>>> >>>> >>>> >>>> >>> >>> >> > "aaj" <a**@aaj.com> schrieb: I assume you are talking about a listview control...> I'm having a really stupid problem with listboxes > I have dropped a listbox on a form and I want to configure the columns If the column doesn't fill the whole horizontal space of the listview > > I just want a single column, but it seems that another blank one is > created by default to the right hand side > > If I set the list box as width 150 and add a column > > LSTProcessList.Columns.Add(New ColumnHeader) > LSTProcessList.Columns(0).Text = "Ref1" > LSTProcessList.Columns(0).Width = 150 > > Then I can grab the top of the column called Ref1, move it to the left and > there is a blank one to the right. control, the header bar will fill the rest of the space. > Is there any way that I can have one single column that scrolls up and Set the column's width to the width of the listview's client size.> down, but not left and right. -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/>
"Type" in parameter list
64 HI/LO DWORD extraction vb.net Excel ADO question SQL-question VB.NET (ASP) Can't convert Dates...help! Formatting timespan objects how to use CurrentRowIndex for datagrid control ? memory stream XML and unicode problem what in vb.net.... StackTraceException on program start |
|||||||||||||||||||||||