void AddressList_ListChanged(object sender, ListChangedEventArgs e) { if (e.ListChangedType == ListChangedType.ItemChanged) { BitcoinAddress addr = ((BindingList <BitcoinAddress>)sender)[e.NewIndex]; if (addr.Address != null) { addr.Validate(addr.Address); } if (!addr.HasErrors) { DataManager.WriteFile(AddressList, DataManager.FileType.Wallet); } } else if (e.ListChangedType == ListChangedType.ItemDeleted || e.ListChangedType == ListChangedType.ItemAdded) { DataManager.WriteFile(AddressList, DataManager.FileType.Wallet); } }