Solved

Multiple column listbox

Posted on 1998-03-07
12
381 Views
Last Modified: 2012-06-22
Hi!
I've two tiny questions.
1-I need a multiple column listbox in my project.Is there
any free ocx that can solve my problem?
2-I use the crystal reports ocx in my project.
I tried to register that by Modem but I didn'd succeed.I want to distribute my application, Is that really necesary?
I tried to install my application but the system hanged.
Is that the reason?             thank you
0
Comment
Question by:nima
  • 4
  • 3
  • 3
  • +1
12 Comments
 
LVL 8

Expert Comment

by:mrmick
ID: 1458640
For the multicolumn listbox, check out the following URL:

http://home.sprynet.com/sprynet/rasanen/vbnet/default.htm

Click "Code Library" on the left, "List & Combo" on the center left, and finally, scroll down on and click on "How to Set Tabstops in a Listbox".  You will find a code example using a normal VB listbox.

In regard to the CR question.  You are not required to register any product you own in order to use or distribute it as long as you have the right to distribute granted in the license agreement.  You are free to distribute the CR that comes with VB (assuming you own VB).

0
 
LVL 8

Expert Comment

by:mrmick
ID: 1458641
Whoops, I suppose I should have added: "Not registering CR isn't the reason your system hung."
0
 

Author Comment

by:nima
ID: 1458642
I actually can do that without using api But I need something
like access list  and combo boxes.with separating lines and
headers.
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

Expert Comment

by:icesurfer
ID: 1458643
u can use the ms flexgrid
0
 

Expert Comment

by:icesurfer
ID: 1458644
or you can concatenate the different data items into
one string and then add that string to a single column
vb list box..
0
 

Author Comment

by:nima
ID: 1458645
The msflexgrid needs a lot of resources and the string cancatenating is not the solution because I need headlines.
so thank you for your answers.
0
 

Expert Comment

by:icesurfer
ID: 1458646
this a list control from www.farpoint.com which can make multiple columns..
try it..i think its what u want..
0
 

Author Comment

by:nima
ID: 1458647
Hi ! icesurfer
Unfortunately I couldn't find any control there.Would you please
be more specific.
                    thank you
0
 
LVL 5

Accepted Solution

by:
nebeker earned 100 total points
ID: 1458648
Why don't you just use the ListView control that's part of Windows?  Just set it to "Report" mode, and you'll get listbox-like functionality, and headers for each column.  In addition, you'll get dynamically resizeable columns.

You can also make the ListView look completely like a listbox by turning on the full row select flag (so the highlight bar extends across all of the columns, instead of the default, which is to just highlight the first column).
0
 

Author Comment

by:nima
ID: 1458649
Thanks a lot for your help.It's exactly what I need.
I just don't know where is that full row selected flag.
I'll appreciate it.
0
 
LVL 5

Expert Comment

by:nebeker
ID: 1458650
Here's some code:

' Change the ListView control to the "Full Row Select" mode, so
' it will act more like a list box...  This style is not
' documented, but the flag exists in the COMMCTRL.H C++
' header file...
'
Call SendMessage(List1.hWnd, LVM_SETSTYLE, 0, LVS_FULLROW)

------
You'll need the following declarations:

' These constants are used to set the full-row select style
' for the ListView...
'
Private Const LVS_FULLROW   As Long = &H20
Private Const LVM_FIRST     As Long = &H1000
Private Const LVM_SETSTYLE  As Long = LVM_FIRST + 54
Private Const LVM_GETSTYLE  As Long = LVM_FIRST + 55

' Declaration of the Win32 API "SendMessage"...
'
Private Declare Function SendMessage Lib "user32" Alias
      "SendMessageA" _
      (ByVal hWnd As Long, ByVal Message As Long, _
       ByVal wParam As Long, ByVal lParam As Long) As Long


0
 
LVL 5

Expert Comment

by:nebeker
ID: 1458651
Another note:

   Call the code I previously posted in your Form Load procedure.  If you want to change the Listview's style in the middle of the program (or turn it off and then back on), you'll
need to call SendMessage using the LVM_GETSTYLE message first, otherwise you'll lose the existing style flags.

For example, to turn off the full row select:

Dim rc as Long
rc = SendMessage( List1.hWnd, LVM_GETSTYLE, 0, 0)
rc = rc Xor LVS_FULLROW
SendMessage( List1.hWnd, LVM_SETSTYLE, 0, rc )

To turn it back on:
rc = SendMessage( List1.hWnd, LVM_GETSTYLE, 0, 0)
rc = rc Or LVS_FULLROW
SendMessage( List1.hWnd, LVM_SETSTYLE, 0, rc )


0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question