Trying to create a Form Event Wizard that fills in a field based on another field in the same table.
If “4RB-30-4 PKG 230/460/3/60 ODP” was entered in Part.PartDescription, and then the user chooses “87FG” as the Part.ClassID, then the Part.ShortChar03 field would be automatically filled in with “4RB”(the characters before the first “-”).
I made an attempt, but couldn’t get it to work.
private void Part_AfterFieldChange(object sender, DataColumnChangeEventArgs args)
{
// ** Argument Properties and Uses **
// args.Row[“FieldName”]
// args.Column, args.ProposedValue, args.Row
// Add Event Handler Code
switch (args.Column.ColumnName)
{
case “ClassID”:
string[] pdesc = PartDescription.Split("-");
string prefix = pdesc[0];
if(args.ProposedValue = "87FG")
args.Row["ShortChar03"] = prefix;
break;
}
}
End up with the following:
--------compile errors------------
Error: CS0103 - line 72 (971) - The name ‘PartDescription’ does not exist in the current context
Error: CS0266 - line 75 (974) - Cannot implicitly convert type ‘object’ to ‘bool’. An explicit conversion exists (are you missing a cast?)
** Compile Failed. **
Any help for a C# newbie would be much appreciated.