Click here to Skip to main content
15,890,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Here is my code, how to get selected checkbox from this code.
1st..i get file name from sqlite and loop it to dynamic checkbox.

<pre lang="c#">

private void DisplayData()
    {
        fileList = GeneralFunc.GetAllFile();

        var checkBoxes = new CheckBox[0];

        for (int i = 0; i < fileList.Count(); i++)
        {
            var checkBox = new CheckBox(this);

            checkBox.Text = fileList[i].ST_filename;
            checkBox.Id = i;
            checkBox.LayoutParameters = new ViewGroup.LayoutParams(LinearLayout.LayoutParams.WrapContent, LinearLayout.LayoutParams.WrapContent);
            linearLayoutClear.AddView(checkBox);
            Array.Resize(ref checkBoxes, i + 1);
            checkBoxes[i] = checkBox;
        }
    }


What I have tried:

I try to get from checkedChangeListener. But i do not know how to get the selected checkbox.
Posted
Comments
[no name] 8-Jan-19 0:14am    
Checkboxes aren't typically "selected"; they are "checked" or "unchecked".
Prifti Constantine 11-Jan-19 10:24am    
You have an array of checkBoxes and you want to find a specific one to see if it is checked or not if im correct?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900