List Changed

Does anybody have any information on how I can use the Data View List Changed event? I want to have a grid refresh when a Data View List has an item deleted or added. I just don’t understand how the coding of that works.

private static void Attribut_DataView_ListChanged(object sender, ListChangedEventArgs args)
	{
		// ** Argument Properties and Uses **
		// Attribut_DataView[0]["FieldName"]
		// args.ListChangedType, args.NewIndex, args.OldIndex
		// ListChangedType.ItemAdded, ListChangedType.ItemChanged, ListChangedType.ItemDeleted, ListChangedType.ItemMoved, ListChangedType.Reset
		// Add Event Handler Code

	}

It tells you in those comments what properties and things are available to you. Pretty self explanatory
IE: Types of changes, and how to access fields and data…
What are you not understanding?

Well when you put it so nicely lol. I have never used this before and I just didn’t know how to write this code.

Nevermind, I found some coding examples elsewhere.

1 Like

sorry, just trying to understand what you were confused about and gauging what you had already tried #TeachAManToFish (or a woman).

Come back and share what you found those so that next time someone else can benefit :slight_smile: #SearchIsYourFriend

1 Like

Here is some reading on event handling that will help with some basics of what’s going on here. It will make Epicors comments make more sense.

I ended up using this and it worked


	private static void Customer_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 "AttrCodeList":
			//MessageBox.Show("Attribute Code List Modified");
			oTrans.Update();
			badcredit();
				break;
		}
	}
1 Like