---
title: "how to set default value for comboBox?"  
description: "how to set default value for comboBox?"  
author: "Anonymous User"  
published: 2014-01-28  
updated: 2014-01-28  
canonical: https://www.mindstick.com/forum/1890/how-to-set-default-value-for-combobox  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# how to set default value for comboBox?

Hey I am making a [comboBox](https://www.mindstick.com/articles/57/display-record-according-to-combobox-selection-in-csharp-dot-net) that is holding a list of all the fonts name on my [system](https://www.mindstick.com/articles/23411/the-most-effective-method-to-find-the-perfect-small-business-phone-system-for-your-business), however at the beginning it does not hold any value and [user needs](https://www.mindstick.com/interview/22969/an-android-application-needs-to-access-device-data-e-g-sms-messages-camera-etc-at-what-stage-user-needs-to-grant-the-permissions) to [click](https://www.mindstick.com/articles/12423/social-login-magento-2-one-click-to-register-social) on it to open it and [select](https://www.mindstick.com/forum/160534/orderby-then-select-vs-select-then-orderby-performance) an item from the list. my [question](https://www.mindstick.com/blog/23175/how-to-solve-neet-question-paper-in-less-time) is how to set the [default value](https://www.mindstick.com/forum/2035/default-value-when-using-singleordefault) for my comboBox (for example 'Arial') in case if nothing has been selected by the user and not to give error.

[foreach](https://www.mindstick.com/forum/33870/how-parallel-foreach-works-internally) (FontFamily fnt in fonts.Families)

{

comboBox1.Items.Add(fnt.Name);

}

## Replies

### Reply by Pravesh Singh

Hi Goti,\

You could search for a [value](https://www.mindstick.com/articles/23219/an-optimized-description-adds-value-to-experience-and-in-turn-effectively-guest-posting-packages) such as "Arial" using FindString:

if (comboBox1.SelectedIndex == -1)

comboBox1.SelectedIndex = comboBox1.FindString("Arial");

If you've got multiple entries starting with "Arial", the above will return the first match starting with Arial, so you may need to search for the exact string:

if (comboBox1.SelectedIndex == -1)

comboBox1.SelectedIndex = comboBox1.FindStringExact("Arial Rounded MT");


---

Original Source: https://www.mindstick.com/forum/1890/how-to-set-default-value-for-combobox

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
