[ Foro de C# ]

Recursividad

20-Mar-2022 08:26
Invitado (al)
0 Respuestas

namespace ArregloBidimencional
{
   public partial class FrmDatos : Form
   {

       String[,] datos = new string[5, 5];
       int Indice = 0;

       public FrmDatos()
       {
           InitializeComponent();
       }

       void AñadirRegistroArreglo()
       {

           datos[Indice, 0] = txtcodigo.Text;
           datos[Indice, 1] = Txtnombres.Text;
           datos[Indice, 2] = txtapellidos.Text;
           datos[Indice, 3] = txtident.Text;
           datos[Indice, 4] = txtfechan.Text;

           Indice++;
           limpiar();
       }


       void MostrarDatosArreglos()
       {
           Txtarreglo.Text = "";
           for (int i = 0; i <= 4; i++)
               Txtarreglo.Text = Txtarreglo.Text + datos[i, 0] + "\t" + datos[i, 1] + "\t" + datos[i, 2] + "\t" + datos[i, 3] + "\t" + datos[i, 4] + "\n";

       }

       void MostrarDatosArreglosDataGrid()
       {

           for (int i = 0; i <= 4; i++)
           {
               if(datos[i, 0] != null)
                   DGvDatos.Rows.Add(new object[] { datos[i, 0], datos[i, 1], datos[i, 2], datos[i, 3], datos[i, 4] });
           }
       }


       void limpiar()
       {
           txtcodigo.Text = "";
           Txtnombres.Text = "";
           txtapellidos.Text = "";
           txtident.Text = "";
           txtfechan.Text = "";


       }



       private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
       {

       }

       //private void Btnlimpiar_Click(object sender, EventArgs e)
       //{
       //    txtcodigo.Text = String.Empty;
       //    Txtnombres.Text = String.Empty;
       //    txtapellidos.Text = String.Empty;
       //    txtident.Text = String.Empty;
       //    txtfechan.Text = String.Empty;

       //}

       private void Btncancelar_Click(object sender, EventArgs e)
       {
           Application.Exit();
       }

       private void Btnagregar_Click(object sender, EventArgs e)
       {

           AñadirRegistroArreglo();

       }

       private void Btnmostrar_Click(object sender, EventArgs e)
       {
           MostrarDatosArreglos();
           MostrarDatosArreglosDataGrid();


       }
       void Recursividad()
       {



       }
   }

   }
Quiero  convertir ese codigo usando recursividad




(No se puede continuar esta discusión porque tiene más de dos meses de antigüedad. Si tienes dudas parecidas, abre un nuevo hilo.)