on 05-21-2008 4:04 PM
Good Day
Experts:
I am having all kind of trouble here today with my combobox. So, I am hoping one of you have had a similar problem and could help. I have a really basic form with 4 controls...2 Comboboxes and 2 Textboxes.
When the screen opens, the 2 Comboboxes are loaded with the valid values and then the last visited record is loaded on the screen. This is all good and works great. When the Find MenuEvent is selected, I run a routine to clear the datasources attached to all 4 of the controls and then set the cursor position. All the data is gones from the screen. Here is where the problem is...when I execute the FIND stepping through the code, the data is still hanging around "behind the scenes" for my comboboxes. Here is the code I use to check for what the User has selected in the Combobox:
Dim UserCombo As SAPbouiCOM.ComboBox
UserCombo = PrintForm.Items.Item("cmbUsrCode").Specific
Dim User As String = UserCombo.Selected.Value
Nothing is on the screen but User is showing the value that use to be on the screen before I ran the Cleardatasources behind the Find MenuEvent.
This is really perplexing to me on how fix this.
Any help is appeciated,
Ed
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello:
David...thanks for replying. It has been one of those days for me here. When I click the link to see your routine, I cannot get to the code to the right that is off the screen. I have no horizontal scroll bar. Do I have to change anything here in my settings to see the link all the way to the right?
Appreciate the help,
EJD
ok Ed,
here it is - without the code markup:
public static void ClearCombo(string FormUID, string ItemUID)
{
int count;
try
{
if ( ((SAPbouiCOM.ComboBox)(SBO_Application.Forms.Item(FormUID).Items.Item(ItemUID).Specific)).ValidValues.Count > 0 )
{
count = ((SAPbouiCOM.ComboBox)(SBO_Application.Forms.Item(FormUID).Items.Item(ItemUID).Specific)).ValidValues.Count;
for (int i = 1; i <= count; i++)
{
((SAPbouiCOM.ComboBox)(SBO_Application.Forms.Item(FormUID).Items.Item(ItemUID).Specific)).ValidValues.Remove(count - i - 0, SAPbouiCOM.BoSearchKey.psk_Index);
}
((SAPbouiCOM.ComboBox)(SBO_Application.Forms.Item(FormUID).Items.Item(ItemUID).Specific)).ValidValues.Add("0", " ");
((SAPbouiCOM.ComboBox)(SBO_Application.Forms.Item(FormUID).Items.Item(ItemUID).Specific)).Select("0", SAPbouiCOM.BoSearchKey.psk_ByValue);
((SAPbouiCOM.ComboBox)(SBO_Application.Forms.Item(FormUID).Items.Item(ItemUID).Specific)).ValidValues.Remove(" ", SAPbouiCOM.BoSearchKey.psk_ByDescription);
}
}
catch (Exception er)
{
globals.AppendTextToFile("B1C_AddOn.log", "#" + Convert.ToString(DateTime.Now) + "# ERROR: " + er.Message + " [globals.ClearCombo]");
}
finally
{
GC.Collect();
}
}
regards
David
User | Count |
---|---|
99 | |
11 | |
11 | |
6 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.