Created
March 23, 2015 18:57
-
-
Save hasokeric/8354599db30eb84e0631 to your computer and use it in GitHub Desktop.
Epicor KeyField Tab or Enter Action
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Add Support for the KeyField to trigger something | |
* when the keyboard is triggered. (Does not come out of the box) | |
* | |
* @type Custom Function | |
* @return void | |
*/ | |
private void txtKeyField_KeyDown(object sender, System.Windows.Forms.KeyEventArgs args) | |
{ | |
if (args.KeyCode == Keys.Tab | args.KeyCode == Keys.Enter) | |
{ | |
string key1 = String.Empty; | |
string key2 = String.Empty; | |
string key3 = String.Empty; | |
string key4 = String.Empty; | |
string key5 = String.Empty; | |
key1 = this.txtKeyField.Text; | |
// Call Adapter method | |
bool result = this.oTrans.GetByID(key1, key2, key3, key4, key5); | |
// Check if the User already has clicked the New Button | |
// if he did then we dont want to do another GetNew() | |
EpiDataView edvLBL = GetDataView("UD08"); | |
if (edvLBL.Row != -1) { | |
return; | |
} | |
if (!result) | |
{ | |
if (this.oTrans.GetNew()) | |
{ | |
//this.txtKeyField.Text = key1; | |
edvLBL.dataView[edvLBL.Row].BeginEdit(); | |
edvLBL.dataView[edvLBL.Row]["Key1"] = key1; | |
edvLBL.dataView[edvLBL.Row].EndEdit(); | |
bool success = this.oTrans.Update(); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment