cmbHaitatubin,cmbShukkasoko,Combo3
private void cmbShukkasoko_SelectedIndexChanged(object sender, System.EventArgs e)
{
if( -1 == cmbShukkasoko.SelectedIndex )
{
clsFormFunction.ComboClear( cmbHaitatubin );
return;
}
string strBushoSokoCode = clsFormFunction.GetComboCD( cmbShukkasoko );
HaitatubinGet( strBushoSokoCode, ref strMsg );
}
private int HaitatubinGet( string strBushoSokoCode, ref string strMsg )
{
。。。。。。。。
intRet = CMPSpKick( strSPName, dtsInParam, ref dtsOutParam, ref dtsHaisouBin );
if( intRet != 0 )
{
strMsg = OutParamGet( dtsOutParam.Tables[0], "@o_ERRMSG" );
return intRet;
}
string strDefault = OutParamGet( dtsOutParam.Tables[0], "@o_CmbDefValue" );
clsFormFunction.ComboDataSetMake( ref dtsCmb, dtsHaisouBin.Tables[0], "BIN", "HAISO_ROOT_MJ" );
clsFormFunction.ComboBind( cmbHaitatubin, dtsCmb );
clsFormFunction.ComboSelect( cmbHaitatubin, strDefault );
clsFormFunction.SetComboPixWidth( cmbHaitatubin );
cmbHaitatubin.SelectionStart = 0;
cmbHaitatubin.SelectionLength = 0;
return 0;
}
//cmbHaitatubin,cmbShukkasoko,Combo3's Leave event
private void combo_FocusLosted(object sender, System.EventArgs e)
{
FormFunction clsFormFunction = new FormFunction();
clsFormFunction.combo_FocusLosted( sender );
switch (((Control)sender).Name)
{
case "cmbShukkasoko":
if( cmbShukkasoko.SelectedIndex == -1 )
{
clsFormFunction.ComboClear( cmbHaitatubin );
return;
}
break;
}
}
现象:1 cmbShukkasoko的text是All items text一部分时,click Combo3, cmbShukkasoko不能自动选择匹配的Item,但
click文本控件(非Combo)时正常(能自动选择匹配的Item)。
2 cmbShukkasoko的SelectedIndexChanged时,
cmbHaitatubin不能自动选择某一项。
*****I 服了GrapeCity.Win.Input ..........
答:在另一个事件combo_TextChanging里,使用了GrapeCity提供的Combo.FindString( ... ),该函数在某些情况不能
检索出对应的Item。结果每次设置SelectedIndex 时,Combo.Text改变,但combo_TextChanging里的Combo.FindString( ... )检索不出,导致e.Cancel = true。
GrapeCity, I fu le u .