
public function result(event:ResultEvent):void{ var array:ArrayCollection = event.result as ArrayCollectionvar obj:Object = new Object()array.addItem(obj)combobox.dataProvider = array}与表
绑定后就不允许
添加元素了吧。 能不能把空行放在
数据表呢?答案是可以的,那有没有别的办法呢,肯定也是有的,selectindex=-1表示未选中任何荐项目在绑定的数据表中增加1行,代码如下: dim mytb as DataTable '此处需实例化mytb,然后绑定控件即可... Dim myRow As DataRow myRow = mytb.NewRow myRow.Item( "xx ") = 0 myRow.Item( "xxx ") = "不选任何项 " dsNodeList.Tables(0).Rows.InsertAt(myRow, 0) With combobox1 .DataSource = mytb .DisplayMember = "xxx " .ValueMember = "xx " End With恩,不能直接使用,需要这样的,如:添加a,b,c三个选项:
case WM_INITDIALOG:
{
char lpszAdd[64]
strcpy(lpszAdd,"a")
SendDlgItemMessage(hDlg, IDC_COMBO1, CB_ADDSTRING , 0,(LPARAM) (LPCTSTR)lpszAdd)
strcpy(lpszAdd,"b")
SendDlgItemMessage(hDlg, IDC_COMBO1, CB_ADDSTRING , 0,(LPARAM) (LPCTSTR)lpszAdd)
strcpy(lpszAdd,"c")
SendDlgItemMessage(hDlg, IDC_COMBO1, CB_ADDSTRING , 0,(LPARAM) (LPCTSTR)lpszAdd)
SendDlgItemMessage(hDlg, IDC_COMBO1,CB_SETCURSEL,0,(WPARAM) 0)//获得用户选择的内容
}
return TRUE
评论列表(0条)