Important alert: (current site time 7/16/2013 2:15:29 AM EDT)
 

winzip icon

LynxComboBox v2.0, The Best Enhancements for Multi-Column ComboBox

Email
Submitted on: 1/9/2009 9:09:51 AM
By: Masino Sinaga  
Level: Intermediate
User Rating: By 27 Users
Compatibility: VB 6.0
Views: 20963
(About the author)
 
     This source code contains some good enhancements that I made for LynxComboBox v1.30 with multi-column drop-down list feature belongs to Richard Mewett that you can get from: http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=61438&lngWId=1 . I have made some modifications and new features on LynxComboBox control. I also have separated the project become two projects (one is LynxComboBoxTest.vbp, and the other is LynxDataCombo.vbp) in order easy for you to compile it become an .ocx file (if neccessary). Just open the RunThisForTest.vbg to test those both project at once. So, let's see what's new that I made so far: (1)--> Changed Private to Public for SearchCode function in order could be used for validating selected text on LynxComboBox. This function is very useful if you want to validate the selected text before saved that selected item or another certain value from drop-down list to your database. (2)--> Added 4 new functions: FindFirstText, FindNextText, FindPrevText, and FindLastText for searching text in the certain column. This search feature included using 3 search-mode ("Equal", "Like", and ">="). This is very useful if you want to find a string on certain column in drop-down list and want to know which item(s) contains that string. If the string found, the item would be selected automatically in the LynxComboBox. See at the demo project. (3)--> Fixed minor-bug on Locked property. Before: KeyPress/KeyDown still work or affected and item could be choosen or selected when Locked = True, After: Now it has been fixed by truly locking when you press the key from your keyboard! I think some of you did not realize this bug, don't you? ;-) (4)--> Added new feature to bind value on certain column in drop-down list to another controls by using two ClassModule (MyControls.cls and MyControl.cls). Those two classes and the technique I got from Marcelo Luiz Altafin on http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=37751&lngWId=1 then I combine them. I also give him a credit for this new feature. This feature is very useful if you want to get the value from certain column of drop-down list and automatically filled-in to another controls on your form (such as TextBox). So, from now on, you don't have to get a value from ItemText manually anymore. Just bind your TextBox control to the LynxComboBox by using .MyControls property... (see at the demo project) and... tarraaa... the TextBox(es) filled-in automatically. Even this feature still works if you press down-arrow or up-arrow key from keyboard to browse the items in LynxComboBox. (5)--> Added function ResetValue to reset value in LynxComboBox and all controls that binds to the LynxComboBox (such as TextBox). This is very useful if you make an entry data form, and after user save the record to database, then the selected item in LynxComboBox on your form back to blank and ready to receive new input again (similiar with Reset button function on HTML). This is also affected to the controls that binds to LynxComboBox (such as TextBox), the value become blank string. I also added a database for test purpose if you want to get the items from your database. I added one form with a progressbar in order to let user know about the progress while retrieving records from database. This is recommended if you get so many records from your database and load them to your LynxComboBox. I changed the version become 2.0.0. To Richard Mewett, I hope you don't mind about this new version, right? :-) The copyright of this user control is still belongs to Richard Mewett and his name is still written on the code because he deserve. Download it and proof it now. Any comments and votes would be truly appreciated. Thank you and have a nice code, everyone. Tag: Multi-Column, multi column drop-down list, drop down list.

 
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
  3. Scan the source code with Minnow's Project Scanner

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.


Other 6 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments
1/7/2009 9:12:27 AMJuned Chhipa

Very Good Masino
***** for you! Thx for sharing.

Keep up the great work..

Juned.
(If this comment was disrespectful, please report it.)

 
1/7/2009 11:49:49 PMhai2hai

Thanks for the great work.

Could you please make the control's border style as appropriate as selected theme (3d, flast, winxp, offcexp) so that we don't have to customized the border colors again.

Thanks much!
(If this comment was disrespectful, please report it.)

 
1/8/2009 5:49:34 AMMark

Very nice update! Thanks for sharing.
(If this comment was disrespectful, please report it.)

 
1/9/2009 12:29:37 PMhai2hai

actually I like this control except the border. I dont like customzed border style with rounded shape. Flat border but the dropdown button is still 3D --> very ugly.

Hope you improve this control.


(If this comment was disrespectful, please report it.)

 
1/10/2009 3:27:24 AMMasino Sinaga

Thank you for votes and comments. After I uploaded the first file (PSC renamed it become: LynxComboB213972162009.zip - date-modified: January 8), I re-uploaded and replaced that .zip file with a new one (PSC renamed the file become: LynxComboB213985182009.zip - date-modified: January 10). The reason why I re-uploded the .zip file is because I found that the .vbg file depends on .ocx file and you will get a MsgBox inform you that the project has dependency with the .ocx file. I've removed the dependency and you won't receive any MsgBox again. I also fixed a small-bug that I found after user sort a certain column in the drop-down list, AutoComplete doesn't work. Now AutoComplete still works even after user sorted column in drop-down list. Please check your .zip file, and make sure you've already downloaded and using the last one with name: LynxComboB213985182009.zip, and its modified-date was January 10. Thanks.

Best regards,
Masino Sinaga
(If this comment was disrespectful, please report it.)

 
1/10/2009 3:52:03 AMcliv

Very good work!
But can i using search from 2 column?
I have a combo like this:
Col1 Col2
A 1
A 2
B 1
B 2
How can i find something like:
Col1=B AND Col2=2

Hope you understand.Congratulation again!!!
(If this comment was disrespectful, please report it.)

 
1/11/2009 4:17:45 AMLa-Rose

Bagus Pak!!!
Thanks banget.
(If this comment was disrespectful, please report it.)

 
1/11/2009 9:35:36 PMMasino Sinaga

@cliv,

Yes, you can. But, in that case, you must add a unique column (similiar with PrimaryKey field in database) contains such as increment value and put it on the first column. Try like this:

Private Sub Command1_Click()
Dim i As Long
For i = 0 To lcTest.ListCount - 1
If lcTest.ItemText(i, 1) = "B" And lcTest.ItemText(i, 2) = "2" Then
lcTest.Text = lcTest.List(i)
Exit For
End If
Next i
End Sub

Private Sub Form_Load()
With lcTest
.FormatString = " .AddItem "1"
.ItemText(.NewIndex, 1) = "A"
.ItemText(.NewIndex, 2) = "1"
.AddItem "2"
.ItemText(.NewIndex, 1) = "A"
.ItemText(.NewIndex, 2) = "2"
.AddItem "3"
.ItemText(.NewIndex, 1) = "B"
.ItemText(.NewIndex, 2) = "1"
.AddItem "4"
.ItemText(.NewIndex, 1) = "B"
.ItemText(.NewIndex, 2) = "2"
End With
End Sub

Best regards,
Masino Sinaga
(If this comment was disrespectful, please report it.)

 
1/11/2009 10:06:42 PMDidi Cendana

Wow, it's great because have new function (search module). Good work Mr.
Masino.
(If this comment was disrespectful, please report it.)

 
1/11/2009 11:02:10 PMMasino Sinaga

@hai2hai,

I wish I could fulfil your request. Unfortunately, the code for drawing the LynxComboBox itself made by Richard Mewett. I just focused on improving for how this control easy to use by adding binding-to-another-control feature and some other features. I hope he or anyone who will be able to do your request will update this control based on this last version that I released. Thanks.

Best regards,
Masino Sinaga
(If this comment was disrespectful, please report it.)

 
1/12/2009 12:17:21 AMyusup andrias

keren bung coding nya ...:)
(If this comment was disrespectful, please report it.)

 
1/12/2009 12:34:00 AMyusup andrias

tx bung, keren banget :))
(If this comment was disrespectful, please report it.)

 
1/13/2009 2:50:40 AMbenu

Very Good Pak. Thanks for sharing.

p.s. that's a great work.

(If this comment was disrespectful, please report it.)

 
1/14/2009 1:52:06 AMBen Ng

Thanks so much for your update.

However, I have one more problem, when I add more than one control with multi-column style to the child form, the application crashed when closing the child form.

Anybody has the same problem with me?

Ben
(If this comment was disrespectful, please report it.)

 
2/9/2009 1:20:54 AMczz

Great work!
but i'm also experiencing the same problem with Ben Ng. i tried to make the main form to MDI Child. IDE crased when child form closed.

(If this comment was disrespectful, please report it.)

 
3/23/2010 7:41:16 AMIsaías

Very gooood
(If this comment was disrespectful, please report it.)

 
6/4/2010 3:43:48 AMRichy III

Great. I tried with 2 controls in mdi child . IDE crased when child form closed.
(If this comment was disrespectful, please report it.)

 
10/30/2010 9:57:29 PMRojalde Arintok

IS this work with the latest version of LynxGrid
(If this comment was disrespectful, please report it.)

 
10/28/2011 2:00:34 PMError

when a add more than one combo in mdiChild a get an error which makes vb close
how can avoid that?
thank you
(If this comment was disrespectful, please report it.)

 
5/22/2012 1:44:12 AMArchie

Any body solves the problem that IDE will crashed when 2 multi combo is added in MDI frm? I have the same problem too!
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.