For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic > December 2005 > How can I set from my program the item selected in a DataComboBox Control?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How can I set from my program the item selected in a DataComboBox Control?
Newbie

2005-12-14, 6:57 pm

I think I used to know this but couldn't see it in help, either.

I'd like a certain item to be selected as a default choice in the
DataCombo when the user enters the program. The combo is working fine
I just don't know how to set the selection.

Thanks for any advice.
Norm Cook

2005-12-15, 6:55 pm

Since the DBCombo is bound to a Data control, you have
to manipulate the Data Control to have the DBCombo
respond as desired:

Private Sub Form_Load()
Data1.Refresh
Data1.Recordset.Move 3 '4th item
End Sub

"Newbie" <Newbie@yahoo.com> wrote in message
news:1hu0q1taclrnspi83kcg362080jjhla0np@
4ax.com...
> I think I used to know this but couldn't see it in help, either.
>
> I'd like a certain item to be selected as a default choice in the
> DataCombo when the user enters the program. The combo is working fine
> I just don't know how to set the selection.
>
> Thanks for any advice.



Newbie

2005-12-16, 3:55 am

On Thu, 15 Dec 2005 08:08:50 -0600, "Norm Cook"
<normcookNOSPAM@cableone.net> wrote:

>Since the DBCombo is bound to a Data control, you have
>to manipulate the Data Control to have the DBCombo
>respond as desired:
>
>Private Sub Form_Load()
> Data1.Refresh
> Data1.Recordset.Move 3 '4th item
>End Sub
>
>"Newbie" <Newbie@yahoo.com> wrote in message
> news:1hu0q1taclrnspi83kcg362080jjhla0np@
4ax.com...
>

I finally found in the help (who would have thunk it was the text
property?) that you can set the combo selection for the dataCombo by
setting the text property to the selection you want.

DC.Text = "Apple" sets the selection to Apple, assuming that
apple is in the list for the combobox.

Newbie
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com