C#

Asked • 08/01/19

Checked List Boxes in Microsoft Excel (C#)?

I am creating an add in for Microsoft Excel. In this program, I allow the user to make a deposit into a user-created budget. Accounts are divided by individual worksheets (one worksheet is an account for clothes, another account for auto work, etc.). Deposits are made using a form that lists all the accounts into a checked list box. The idea is to allow the user to automatically put a fraction of the deposit only into each account on the list that is checked. Any cash that isn't distributed is placed back into the main budget as idle cash. The code I'm using at the moment is as follows: decimal deposit = 0; private void btnDeposit_Click(object sender, EventArgs e) { deposit = Convert.ToDecimal(txtDeposit.Text); AccountingAddIn.ThisAddIn.blake.addToBudget(deposit); foreach (Account acc in AccountingAddIn.ThisAddIn.Accounts) { acc.addToBalance(deposit / AccountingAddIn.ThisAddIn.Accounts.Count); AccountingAddIn.ThisAddIn.blake.updateBudget(acc); } } The code itself works just fine. I can even select a list item and move it up and down the list with no errors. What I need to know is how do I specify the above function such that it only works on list items that are actually checked. More specifically, how do I determine if an item(s) in a checked list box is checked? If possible, please cite an example. Thanks!

1 Expert Answer

By:

Dylan B. answered • 11/10/20

Tutor
New to Wyzant

Computer science Tutor, Associates degree, Real world experience

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.