How to count total no of items in a combobox

May 29 2018 3:54 AM
1. Here is my code 
void bindFinancialYear()
{
string str = "SELECT FYearID, concat( YEAR(startdate),'-',YEAR(enddate)) AS FinancialYear FROM FinancialYear ORDER BY FYearID DESC";
DataTable dtcombo = objdal.GetDataTable(str);
if (dtcombo.Rows.Count > 0)
{
cbFinancialYear.DataSource = dtcombo;
cbFinancialYear.DisplayMember = "FinancialYear";
cbFinancialYear.ValueMember = "FYearID";
cbFinancialYear.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;//To make combox readonly. User can type to search
cbFinancialYear.SelectedIndex = 0;
}
}
 
2. How to show total no of items in this cbFinancialYear Combobox.
Help me. 

Answers (2)