i want when i run the form that have combobox , i need default or selected an item by default
how is that in visual studio 2010 professional
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
VulpesPosted May 28, 2012, 6:35 PM
comboBox1.SelectedIndex = 1;
Satyapriya NayakPosted May 28, 2012, 11:08 PM
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Datagridview_bind
{
public partial class Form4 : Form
{
public Form4()
{
InitializeComponent();
}
private void Form4_Load(object sender, EventArgs e)
{
comboBox1.Items.Add("Selected an item");
comboBox1.Items.Add("a");
comboBox1.Items.Add("b");
comboBox1.Items.Add("c");
comboBox1.SelectedIndex = 0;
}
}
}
Thanks