URGENT; VB ComboBox problems 
Author Message
 URGENT; VB ComboBox problems

My problem:

A combo-box in a program I am writing is INITIALLY filled with the
contents of a database table.

(The usual method for adding data to a combo-box is via the .AddItem
method, followed by
  .ItemData(combobox.NewIndex) = 'whatever my value is'  ; which is what
I'm doing.)

At one point in the course of this program, this combo-box may have to
display the contents of a database record in which 1 of the fields will
be equal to one of the original contents of this combo-box.

So, basically, I want to use this combo-box to display the contents of 1
field from a record, OR, to
set this same field.

(Lousy explanation?)

How do I do this?

I began by changing the combo-box's .Text property to the name of the
contents of the record's field.
Then, most likely, the .ListIndex property has to be modified. How?

Someone please help me. (also send me a reply to my e-mail account:

Thank-you,
Angelo

Another small question:

I want to save the name of a form, hide this form, display a second
form, then be able to re-display
the first whenever I want to.

Saving the active form is not a problem ( saved_form =
Screen.ActiveForm.Name).

How do I then display it whenever needed?



Wed, 15 Dec 1999 03:00:00 GMT  
 URGENT; VB ComboBox problems

Hi Angelo:

Quote:
> At one point in the course of this program, this combo-box may have to
> display the contents of a database record in which 1 of the fields will
> be equal to one of the original contents of this combo-box.

What I would suggest, is to use a Counter field in your database table.
That way,
you could set the ItemData value to that of the counter field for the
record, i.e.

  Combo1.AddItem "" & rs.MyField
  Combo1.ItemData(Combo1.NewIndex) = rs!MyCounterField

Then when you want to find the record in the table,

  rs.FindFirst "MyCounterField = " & Combo1.ItemData(Combo1.ListIndex)

Quote:
> I want to save the name of a form, hide this form, display a second
> form, then be able to re-display
> the first whenever I want to.

> Saving the active form is not a problem ( saved_form =
> Screen.ActiveForm.Name).

> How do I then display it whenever needed?

Instead of saving the form name, perhaps you could save the form itself,
i.e.

  Dim frm As Form

  Set frm = Screen.ActiveForm
  ...etc
  frm.Show
  Set frm = Nothing

Hope this helps,

Doug.



Fri, 17 Dec 1999 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Problem with Microsoft ComboBox as well as MicroHelp ComboBox

2. I need to have VB ComboBox Behave like access ComboBox

3. combobox within datagrid -- need urgent help

4. Combobox VB 4.0 Problem

5. Subclassing ComboBox - Urgent!

6. VB Application Setup problem.......Urgent...

7. SQL problems with vb -URGENT

8. Reports - VB 6 - Grouping Problem Urgent

9. SHELL problems, VB 3.0 !URGENT!

10. URGENT: VB COM object has security permissions problem under SP5

11. Urgent, help please: Problem exporting report CR 8 and VB 6

12. URGENT - CRYSTAL DEPENDANCY PROBLEM WITH VB 6

 

 
Powered by phpBB® Forum Software