TextBox & ChooseFromList
Manuel Kübler
ich hab eine TextBox, diese hat ein ChooseFromList auf den Artikelstamm. Wie kann ich nun den ItemCode in die TextBox eintragen und dann weiterverarbeiten?Anders Olsson
Hello Manuel,You need to attach a ChooseFromListHandler to the CFL. In the eventhandler you can get the selected value(s) and react accordingly.
The event handler will also execute when the user tabs out of the TextEdit having selected a valid value.
This example uses Business Partners instead of Item Master Data, but the concept is the same:
public void Execute()
{
// Create the B1 form
Form b1Form = Form.CreateNewForm(UniqueStringGenerator.Next(), UniqueStringGenerator.Next());
// Add a TextEdit
TextEdit txtEdit = TextEdit.CreateNew(UniqueStringGenerator.Next());
b1Form.AddItem(txtEdit);
// Create the ChooseFromList and attach it to the TextEdit
ChooseFromList cflTextEdit = new ChooseFromList(new ChooseFromList.DefaultSQLQuery("SELECT CardCode, CardName FROM OCRD"), "CardCode", true, true, txtEdit);
cflTextEdit.ChooseFromListEvent += new ChooseFromList.ChooseFromListHandler(cflTextEdit_ChooseFromListEvent);
b1Form.Load();
}
private void cflTextEdit_ChooseFromListEvent(ChooseFromListEvent e)
{
string cardCode;
string customerName;
e.Results[0].TryGetValue("CardCode", out cardCode);
e.Results[0].TryGetValue("CardName", out customerName);
// Do something with the selected customer...
}
Regards,
Anders Olsson
0
Please sign in to leave a comment.
Comments
0 comments