Solved

Multiple column listbox

Posted on 1998-03-07
12
383 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 

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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Suggested Solutions

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

751 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