C# winform
how to fill Textbox on the basis of combobox value selection,,, Eg: If I select value A from combobox then B is automatically assign to textbox
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Satyapriya NayakRank #47 · 31.5K reputationPosted Jun 7, 2014, 12:29 AM EDT
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
comboBox1.Items.Add("---Select---");
comboBox1.Items.Add("A");
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
if (comboBox1.Text == "A")
{
textBox1.Text = "B";
}
else
{
textBox1.Text = "";
}
}
}
}
VulpesRank #55 · 29.2K reputationPosted Jun 6, 2014, 3:48 PM EDT