Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Multiple column listbox

Posted on 1998-03-07
12
Medium Priority
?
386 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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 400 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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…
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…
Suggested Courses

773 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