17 Feb 2014

combobox selected changed event in wpf c#

In this post , I explained how to
Bind combobox windows application, and selection changed event source code.


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Telerik.WinControls;

namespace company
{
    public partial class Test : Telerik.WinControls.UI.RadForm
    {
        public Test()
        {
            InitializeComponent();
        }

  private void cmbTest_SelectionChangeCommitted(object sender, EventArgs e)
        {
            if (cmbTest.SelectedIndex > 0)
            {
                SqlDataAdapter da = new SqlDataAdapter("select * from tableMASTER where CODE='" + cmbTest.SelectedValue + "'", con);
                DataSet ds = new DataSet();
                da.Fill(ds, "Details");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    txtAmount.Text = ds.Tables[0].Rows[0]["AMOUNT"].ToString();
                    txtBidDay.Text = ds.Tables[0].Rows[0]["DAY_OF"].ToString();
                    txtName.Text = ds.Tables[0].Rows[0]["NAME"].ToString();
                }
            }
            else
            {
                txtAmount.Clear();
                txtBidDay.Clear();
                txtName.Clear();
            }
        }    }
}


No comments:

Post a Comment