Solved

Multiple column listbox

Posted on 1998-03-07
12
380 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
Comment Utility
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
Comment Utility
Whoops, I suppose I should have added: "Not registering CR isn't the reason your system hung."
0
 

Author Comment

by:nima
Comment Utility
I actually can do that without using api But I need something
like access list  and combo boxes.with separating lines and
headers.
0
 

Expert Comment

by:icesurfer
Comment Utility
u can use the ms flexgrid
0
 

Expert Comment

by:icesurfer
Comment Utility
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
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Expert Comment

by:icesurfer
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
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…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

728 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now