|
-
March 14th, 2007, 01:14 PM
#1
Combo box (Forms 2.0 Object Library)
I'm using a combo box (Microsoft Forms 2.0 Object Library) that has the property of being able to Match Entry by the First Letter. This combo object doesn't support the property of .ItemData or .NewIndex.
Using this combo box I want to save the index to the selected item. Can anyone help me?
Thank-u,
Donna
-
March 14th, 2007, 05:03 PM
#2
Re: Combo box (Forms 2.0 Object Library)
Are you doing this in VB6 or VBA?
-
March 14th, 2007, 05:58 PM
#3
Re: Combo box (Forms 2.0 Object Library)
Just store the index in a public variable of the form on the change event
Code:
Public MyIndex as Long
Private Sub MyCombo_Change()
MyIndex = MyCombo.ListIndex
End Sub
Even if everybody spoke the same language, nobody would be speaking the same language.
--Daniel
-
March 14th, 2007, 06:05 PM
#4
Re: Combo box (Forms 2.0 Object Library)
 Originally Posted by bushmobile
Are you doing this in VB6 or VBA?
Basically you can add a class where you have each item and its index and if you whish, also some other data too.
But isn't Forms2 basically for VBA ? As I remember, when used in VB in compiled programs in a programs setup, I got troubles to distribute the code to other machines.
 Jonny Poet
To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
If anyone felt he has got help, show it in rating the post.
Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
My latest articles :
Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7
-
March 14th, 2007, 06:12 PM
#5
Re: Combo box (Forms 2.0 Object Library)
It's part of Office, so you can't distribute it. Use the VB6 control instead.
-
March 15th, 2007, 09:46 AM
#6
Re: Combo box (Forms 2.0 Object Library)
I'm using VB6 and I want to store the index for each item in the list. For other combo boxes I use:
With frmNice
While Not rs.EOF
.cboStatus.AddItem rs!Description
.cboStatus.ItemData(.cboStatus.NewIndex) = rs!Key
rs.MoveNext
Wend
End With
I added this code instead, but am having trouble extracting the index to the selected item.
iindex = 0
With frmNice
While Not rs.EOF
.cboStatus.AddItem rs!Description
.cboStatus.List(iindex,1) = rs!Key
iindex = iindex + 1
rs.MoveNext
Wend
End With
I tend to make things harder than they really are! thanx again.
-
March 15th, 2007, 10:47 AM
#7
Re: Combo box (Forms 2.0 Object Library)
There is no array. You have to use the ItemData(x) field.
Code:
For x = 0 To 5
List1.AddItem Chr$(34) & x & Chr$(34)
List1.ItemData(x) = 0
Next x
-
March 15th, 2007, 11:08 AM
#8
Re: Combo box (Forms 2.0 Object Library)
The combo box from Forms 2.0 Object Library, does not support that property.
-
March 15th, 2007, 11:22 AM
#9
Re: Combo box (Forms 2.0 Object Library)
Why don't you use the Windows Combo instead? Otherwise, create an array for the key. Use the same index as the combobox.
I often load fields into array fieldnames, so I don't have to get them from the db more than once.
-
March 15th, 2007, 03:12 PM
#10
Re: Combo box (Forms 2.0 Object Library)
 Originally Posted by donna_H
I'm using VB6 and I want to store the index for each item in the list. ...
I'm again coming back to the point you cannot distribute a VB6 program which uses form2 controls. I kne that the hanling of the forms2 combo is near to an autocomplete combobox, but it has other problems as you see. Or do you need the program only for your own usage ? Or would you distribute it only together with the office package. In this case you would need to tell people to first install office and then installing your program. But I'm not sure if in new office versions there are still form2 controls.
 Jonny Poet
To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
If anyone felt he has got help, show it in rating the post.
Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
My latest articles :
Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7
-
March 15th, 2007, 03:36 PM
#11
Re: Combo box (Forms 2.0 Object Library)
It will NOT install on other machines, and the program will only run if the identical version of Word is running. It is ILLEGAL to distribute some controls that other apps use. Use the VB6 controls for free!
-
March 15th, 2007, 04:15 PM
#12
Re: Combo box (Forms 2.0 Object Library)
 Originally Posted by dglienna
It will NOT install on other machines, and the program will only run if the identical version of Word is running. It is ILLEGAL to distribute some controls that other apps use. Use the VB6 controls for free!
While you can't distribute Forms 2.0, it doesn't require Office, and it doesn't mean your distributed app can't use it.
 Originally Posted by ChaosTheEternal
There is a Component available, though, called Forms 2.0, ..., but it is not directly distributable. See this Microsoft article about how to distribute it (or to basically sum [the article] up, it requires end users to install, at the very least, the MS ActiveX Control Pad, or to already have a version of Office newer than 97), and where to download it.
But, I'd agree, a Forms 2.0 combo box is not the way to go. The standard VB combo box should work, even if you need something in the back end to help out with your goal, like an array (as dglienna suggested).
-
March 15th, 2007, 05:02 PM
#13
Re: Combo box (Forms 2.0 Object Library)
Even if redistribution isn't an issue, you shouldn't use the Forms 2.0 object library - it's unstable in the VB6 environment with a tendency for "out of memory" errors - MS advise against its use.
-
March 15th, 2007, 07:10 PM
#14
Re: Combo box (Forms 2.0 Object Library)
 Originally Posted by bushmobile
--- you shouldn't use the Forms 2.0 object library - it's unstable in the VB6 environment with a tendency for "out of memory" errors - MS advise against its use.
Exactly whats my experience.
If you dont have hundrtets of items to load into your combo but you need an autocomplete Combobox you can try to use the ActiveX Combo control which is designed in the thread
http://www.codeguru.com/forum/showpo...&postcount=123
Lesson 14 is the last version of the combo. If you want to look how to design such a Userdefined control, you can follow up the whole thread.
You will learn to create your own classes and collections so it would be easy for you to administrate very complex data if you need to do so.
Jonny Poet
Last edited by JonnyPoet; March 15th, 2007 at 07:21 PM.
 Jonny Poet
To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
If anyone felt he has got help, show it in rating the post.
Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
My latest articles :
Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7
-
March 15th, 2007, 07:17 PM
#15
Re: Combo box (Forms 2.0 Object Library)
Been there, done that already also. Too much grief. Heed our advice!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|