martes, 4 de junio de 2013

YOLO

namespace WindowsFormsApplication1



{
public partial class Form1 : Form



{
public Form1()



{

InitializeComponent();

}
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)



{

}
private void button1_Click(object sender, EventArgs e)



{

dataGridView1.Rows.Clear();
Random r = new Random();

int limite = int.Parse(textBox1.Text);

int[] numeros = new int[limite];

for (int a = 0; a < limite; a++)



{

numeros[a] = r.Next(1, 99);
if (a > 0)



{
for (int w = 0; w < 0; w++)



{
for (int d = 0; d < a; d++)



{

numeros[a] = numeros[d];

{

numeros[a] = r.Next(1, 99);

}

}

}

}

}
for (int a = 0; a < limite; a++)



dataGridView1.Rows.Add(a + 1, numeros[a]);

}
private void button2_Click(object sender, EventArgs e)



{
DataGridViewColumnCollection cc = dataGridView1.Columns;

DataGridViewColumn Column1 = cc.GetFirstColumn(DataGridViewElementStates.Visible);

DataGridViewColumn Column2 = cc.GetLastColumn(DataGridViewElementStates.Visible, DataGridViewElementStates.None);

int Cc1 = Column1.DisplayIndex;



Column1.DisplayIndex = Column2.DisplayIndex;

Column2.DisplayIndex = Cc1;

}

}

}

2 comentarios:

  1. int v, w, g, h;
    w = Convert.ToInt32(textBox1.Text);
    dataGridView1.Rows.Clear();
    Random r = new Random();

    for(v=1;v<=w;v++)
    {
    g = r.Next(1, 99);
    h = r.Next(1, 99);
    dataGridView1.Rows.Add(g, h);
    }

    ResponderEliminar
  2. int a, b, c, mano, x;
    Tablita.Rows.Clear();
    x = Convert.ToInt32(Cajita.Text)/2;
    Random dedo = new Random();
    for (c = 1; c <= x; c++)
    {
    a = dedo.Next(100);
    b = dedo.Next(100);
    Tablita.Rows.Add(a, b);

    }
    if (Convert.ToInt32(Cajita.Text) % 2 == 1)
    {
    mano=dedo.Next(100);
    Tablita.Rows[x].Cells[0].Value = mano;
    }
    esto va en el de invertir
    int azul, x;
    string raro,rara;
    x = Convert.ToInt32(Cajita.Text)/2;
    for (azul=0; azul<=x; azul++)
    {
    raro = Convert.ToString(Tablita.Rows[azul].Cells[1].FormattedValue);
    rara= Convert.ToString(Tablita.Rows[azul].Cells[0].FormattedValue);
    Tablita.Rows[azul].Cells[0].Value = raro;
    Tablita.Rows[azul].Cells[1].Value =rara;
    }

    ResponderEliminar