-
August 18th, 2003, 04:10 AM
#1
Set DataCombo Current Selection
Hi,
Does anyone know how to set the current selection in the DataCombo control?
In the Combobox I think there's a SetCurSel method, but this method is not available for the DataCombo control.
Please help, I've been trying to figure it out the hole day.
I'm using ADO and the binding code is below.
_RecordsetPtr rs; //recordset object
//opens recordset...
......
//sets dataCombo
m_AnsTyp.putref_RowSource((LPUNKNOWN) rs);
m_AnsTyp.put_ListField("AnsTypDes");
m_AnsTyp.put_BoundColumn("AnsTyp");
m_AnsTyp.put_BoundText("AnsTypDes");
Thks a lot
Beatrice
-
September 16th, 2003, 10:55 AM
#2
there is a simple (maybe not the best) way:
string mycurrentselection="3";
for (int i=0;i<combo.items.count;i++){
if (mycurrentselection==combo.selecteditem.value){
combo.selectedindex=i;
break;
}
}
check the syntax... caps, etc.. of this code, please
good luck!
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
|