how many times can you spot the letter "o" in:
q: como substituir um caractere por outro na coluna “semana1” do datagridview? quero trocar “r$” por “r$ 0,00”, mas tem dado erro.
        private void frmtrimestre3_load(object sender, eventargs e)
        {
            dgvcalculo();
            personalizardgv();
        }
       
         private void personalizardgv()
        {
  
            // largura das colunas
            dgviewpersonalizado12.columns[0].width = 64;
            dgviewpersonalizado12.columns[1].width = 105;
            dgviewpersonalizado12.columns[2].width = 64;
            dgviewpersonalizado12.columns[3].width = 105;
            dgviewpersonalizado12.columns[4].width = 64;
            dgviewpersonalizado12.columns[5].width = 105;
            dgviewpersonalizado12.columns[6].width = 64;
            dgviewpersonalizado12.columns[7].width = 105;
            dgviewpersonalizado12.columns[8].width = 64;
            dgviewpersonalizado12.columns[9].width = 105;
            dgviewpersonalizado12.columns[10].width = 64;
            dgviewpersonalizado12.columns[11].width = 105;
            dgviewpersonalizado12.columnheadersvisible = false;
            dgviewpersonalizado12.defaultcellstyle.alignment = datagridviewcontentalignment.middlecenter;
            dgviewpersonalizado12.columns[0].defaultcellstyle.font = new font("calibri", 12f, fontstyle.italic, graphicsunit.point, ((byte)(0)));
        }
       
         private void dgvalterar()
        {
          

           try
            {
                foreach (datagridviewrow row in dcalculo2.rows)
                {

                    if (this.text != "")
                    {
                        row.cells["semana1"].value = this.text;
                        //row.cells["semana1"].style.backcolor = color.yellowgreen;
                        row.cells["semana1"].value.tostring().replace("r$", "");
                        row.cells["semana1"].value.tostring().replace(".", "");
                        row.cells["semana1"].value.tostring().trim();
                        this.text = convert.todouble(row.cells["semana1"].value).tostring("c");

                    }
                }
            }
            catch
            {

                this.text = "r$ 0,00";
            }
                            
        }



 private void dgvcalculo()

        {
            var dcalculo = dgviewpersonalizado12;  

   
dgviewpersonalizado12.autogeneratecolumns = false;



            dgviewpersonalizado12.columnheadersvisible = false;

            dgviewpersonalizado12.columncount = 12;

            dgviewpersonalizado12.rowcount = 7;
            
            // nome das colunas
            dcalculo.columns[0].name = "data0";
            dcalculo.columns[1].name = "semana1";
            dcalculo.columns[2].name = "data1";
            dcalculo.columns[3].name = "semana2";
            dcalculo.columns[4].name = "data2";
            dcalculo.columns[5].name = "semana3";
            dcalculo.columns[6].name = "data3";
            dcalculo.columns[7].name = "semana4";
            dcalculo.columns[8].name = "data4";
            dcalculo.columns[9].name = "semana5";
            dcalculo.columns[10].name = "data5";
            dcalculo.columns[11].name = "semana6";

            // data hora     
            dcalculo.columns["data0"].valuetype = typeof(datetime);
            dcalculo.columns["data0"].defaultcellstyle.format = "dd/mmm";

            // valor monetário
            dcalculo.columns["semana1"].valuetype = typeof(double);
            dcalculo.columns["semana1"].defaultcellstyle.format = "c";


            double total2 = 0;
            try
            {
                foreach (datagridviewrow row in dcalculo.rows)
                {

                    if (row.cells["semana1"].value != dbnull.value)
                    {
                        total2 += convert.todouble(row.cells["semana1"].value);

                    }

                    label20.text = total2.tostring("c");
                }
            }
            catch 
            {

                label20.text = "";
            }
            

        }


private void dgviewpersonalizado12_cellendedit(object sender, datagridviewcelleventargs e)

        {

            dgvalterar();
            dgvcalculo();
        }


a: se deseja formatar uma coluna tente isso:
dcalculo.columns["semana1"].defaultcellstyle.format = "n2";

user
There are one hundred and eighty-two "o"s in the text you provided.
assistant