0
Hello, folks all right, I have an application where I add the items in Datagridview, however I want to add the volume values, the lines that are with the same name, I want to create a variable to receive the repeated name and the sum of the values, I have the example code and I’ll show you so you can help me because I’m not getting.
avoid placing images, put the code in the question, it is much more readable
– Ricardo Pontual
perfect friend, I’ll do it thank you.
– Mecleudio Queiroz
where the data from dgv ? where there is EF in the code ?
– Rovann Linhalis
data is coming from textbox and being add to datagrig.
– Mecleudio Queiroz
private void btnAionar_Click(Object Sender, Eventargs and) {
 CamposGrid();
 dtCargas.Rows.Add lblCodigo.Text, txtNomePopular.Text, txtPlaqueta.Text 
 txtCoc.Text, txtPicada.Text,txtSecTora.Text, txtD1Dof.Text, txtD2Dof.Text,
 txtCompDof.Text, txtVolumeDof.Text, txtD1.Text, txtD2.Text, txtComp.Text, txtVolumeCompra.Text, txtPatio.Text, txtSomaEspecie.Text, txtCodigo.Text, dateTimePicker1.Text); }
– Mecleudio Queiroz
In my view I would add the form data in a LIST, then move the list to the grid, because that way it would be easy to do what you want. I would use Linq, with SUM and DISTINCT to sum the desired values where the name repeated.
– Agnaldo