---
title: "How to get index value in combo box?"  
description: "How to get index value in combo box?"  
author: "Anonymous User"  
published: 2014-01-25  
updated: 2014-01-25  
canonical: https://www.mindstick.com/forum/1868/how-to-get-index-value-in-combo-box  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# How to get index value in combo box?

I have a [ComboBox](https://www.mindstick.com/articles/57/display-record-according-to-combobox-selection-in-csharp-dot-net) with two [values](https://www.mindstick.com/forum/327/sum-textbox-values) 'cash' and 'bank' if the [user](https://www.mindstick.com/articles/13001/multi-statement-table-valued-user-defined-function-in-sql-server) selects bank I need to enable [two controls](https://www.mindstick.com/forum/33404/delegate-classes-connection-with-two-controls-in-objective-c). I've tried below [code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii):

[private](https://www.mindstick.com/blog/11097/java-access-modifiers-the-public-and-the-private-modifiers) void comboBox_pay_type_SelectedIndexChanged(object sender, EventArgs e)

{

if (comboBox_bank.SelectedIndex == 1)

{

comboBox_bank.Enabled = true;

textBox_recp_no.Enabled = true;

}

}

[Problem](https://yourviews.mindstick.com/view/81399/tackling-the-problem-of-unemployment-during-corona-pandemic) is the [index](https://www.mindstick.com/blog/198/index-in-sql-server) [value](https://www.mindstick.com/articles/23219/an-optimized-description-adds-value-to-experience-and-in-turn-effectively-guest-posting-packages) is -1 for both cash and bank. Where have I made an [error](https://yourviews.mindstick.com/view/88527/fixing-quickbooks-error-4120-reinstalling-vs-repairing)?

## Replies

### Reply by Pravesh Singh

Hi Ankita,\

You're just referencing the wrong combo box:

```
private void comboBox_pay_type_SelectedIndexChanged(object sender, EventArgs e){    if(comboBox_pay.SelectedIndex == 1)    {       
comboBox_bank.Enabled = true;       
textBox_recp_no.Enabled = true;    }}
```

You need to reference comboBox_pay here.


---

Original Source: https://www.mindstick.com/forum/1868/how-to-get-index-value-in-combo-box

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
