Galera, estou quase terminando um programa que estou aprendendo a fazer, para concluir preciso fazer a soma de uma coluna do Banco (mdb) e ele mostrar em um textbox.
[code]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 WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void bd_impBindingNavigatorSaveItem_Click(object sender, EventArgs e)
{
this.Validate();
this.bd_impBindingSource.EndEdit();
this.tableAdapterManager.UpdateAll(this.impostodbDataSet);
}
private void Form1_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'impostodbDataSet.bd_imp' table. You can move, or remove it, as needed.
this.bd_impTableAdapter.Fill(this.impostodbDataSet.bd_imp);
}
private void códigoTextBox_TextChanged(object sender, EventArgs e)
{
}
private void valorTextBox_TextChanged(object sender, EventArgs e)
{
}
private void impostoTextBox_TextChanged(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
double valor1, valor2;
double imposto1;
String valor3;
valor1 = int.Parse(valorTextBox.Text);
if (valor1 > 1000)
{
valor2 = (valor1 / 100) * 15;
valor3 = valor2.ToString();
this.impostoTextBox.Text = valor3;
}
else
{
valor2 = (valor1 / 100) * 10;
valor3 = valor2.ToString();
this.impostoTextBox.Text = valor3;
}
}
private void label1_Click(object sender, EventArgs e)
{
}
private void valorTextBox_TextChanged_1(object sender, EventArgs e)
{
}
private void valorLabel_Click(object sender, EventArgs e)
{
}
private void maskedTextBox1_MaskInputRejected(object sender, MaskInputRejectedEventArgs e)
{
[color=red]// queria que a soma da coluna “imposto” fosse sendo somada de acordo com a entrada de dados e printasse nesse campo.[/color]
}
}
}