Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Refreshing all winform Objects with new Data loaded.
Message
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Titre:
Refreshing all winform Objects with new Data loaded.
Divers
Thread ID:
01386186
Message ID:
01386186
Vues:
96
C # 2005.

Dear friends :

my question is it :
My winform have a datagridvied and some texbox.

i have a method that return a DataTable with an unique record(parametrizaded store procedure in sql server).
when the form first run the form load the a sample record, but when i type another value in the Customer id Textbox, only
the datagridview is refreshed with the new data, the textboxs retain the the prior values.

i am lookin some samples about "refreshing textbox with new data loaded" but i don't find any thing.
i am a beginer.

Your help is great appreciated:


DataTable Customers;
private void frmMantenimientoClientes_Load(object sender, EventArgs e)
{
cCliente = textBox1.Text;
getCategories(cCliente);
}
private void getCategories(string cCliente)
{

if (firsload==false)
{
BindControls();
firsload = true ;
}
else
{
this.RefreshControls();
}
}

private void button1_Click(object sender, EventArgs e)
{
cCliente = textBox1.Text;
getCategories(cCliente);
}
private void BindControls()
{
this.RefreshControls();
//this.txtcustomerIDTextBox.DataBindings.Add(new Binding("Text", Customers.DefaultView, "CustomerID", true));
this.txtcustomerIDTextBox.DataBindings.Add("Text", Customers.DefaultView, "CustomerID", true);
this.txtcompanyNameTextBox.DataBindings.Add(new Binding("Text", Customers.DefaultView, "CompanyName", true));
this.txtcontactNameTextBox.DataBindings.Add(new Binding("Text", Customers.DefaultView, "ContactName", true));
this.txtcontactTitleTextBox.DataBindings.Add(new Binding("Text", Customers.DefaultView, "ContactTitle", true));
this.txtaddressTextBox.DataBindings.Add(new Binding("Text", Customers.DefaultView, "Address", true));
this.txtcityTextBox.DataBindings.Add(new Binding("Text", Customers.DefaultView, "City", true));
this.txtregionTextBox.DataBindings.Add(new Binding("Text", Customers.DefaultView, "Region", true));
this.txtpostalCodeTextBox.DataBindings.Add(new Binding("Text", Customers.DefaultView, "PostalCode", true));
this.txtcountryTextBox.DataBindings.Add(new Binding("Text", Customers.DefaultView, "Country", true));
this.txtphoneTextBox.DataBindings.Add(new Binding("Text", Customers.DefaultView, "Phone", true));
this.txtfaxTextBox.DataBindings.Add(new Binding("Text", Customers.DefaultView, "Fax", true));
}

private void RefreshControls()
{
Customers = CatalogAccess.GetCustomers(cCliente);
dataGridView1.DataSource = Customers.DefaultView;
}
}
William Chavez
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform