Click here to Skip to main content
15,918,808 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am Creating employee and going to connect with employees designation.
Employees data stored in one file like name and other details.Designation stored in other. when I am creating employee name there i am displaying one combo box bounded with designation table.While I am creating employees designation is not there what I need in combo box, I created one button to create designation. When I click on that button I am calling designation create form. There I am Entering new designation. But that designation is not updating in combo box what I placed in employee creation form. So how to do that.

What I have tried:

I am not getting any idea how to refresh that combo box. I am refreshing that combobox every time when I am Loading the form.
Posted
Updated 22-Jun-17 0:02am
Comments
F-ES Sitecore 22-Jun-17 4:37am    
You'll have to post the relevant bits of your code. We don't even know if this is a website or a desktop app.
Shah Chandra 22-Jun-17 8:53am    
I think the best option would be to create a refresh button just side of combobox, which when clicked calls the refresh function for the combobox.
vijay_bale 27-Jun-17 10:07am    
I did like that only. thanks

1 solution

Maybe it's simpler to use a DataGridView, example:
C#
using System;
using System.Configuration;
using System.Data;
using System.Data.Common;
using System.Data.SqlClient;
using System.Windows.Forms;

// Put below lines in a method
string customers = "SELECT * FROM Customers";

using (SqlConnection con = new SqlConnection("Data Source=MY-PCNAME;Initial Catalog=northwind;Integrated Security=True"))
{
	DataSet ds = new DataSet();
	SqlDataAdapter da = new SqlDataAdapter(customers, con);
	da.Fill(ds, "Customers");
	dataGridView.AutoGenerateColumns = true;
	dataGridView.DataSource = ds;
	dataGridView.DataMember = "Customers";
}
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900