Mostrar Mensajes

Esta sección te permite ver todos los posts escritos por este usuario. Ten en cuenta que sólo puedes ver los posts escritos en zonas a las que tienes acceso en este momento.


Mensajes - Mastermind

Páginas: 1 ... 4 5 6 7 8 [9] 10 11 12 13 14 ... 24
161
De todo un poco... / Re:Verificar un campo en la base de datos
« en: 07 de Noviembre 2014, 17:27 »
Hola, tendría que ver el código completo para poder responder (si es muy extenso puedes ponerlo como archivos adjuntos).

A la vista del código que has puesto:

SesionHabitacion.verificarActivo(habitacion.getCodigo())

esto indica que el método verificarActivo recibe un código de habitación y devuelve true si está libre (activa) ó false si está en uso.

En la clase donde se define este método debes tener un método similar a setActivo(Codigo codigo, boolean valorQueSeEstablece) ó establecerActivo(String codigo, boolean valorQueSeEstablece) o algo así.

Una vez terminas el proceso y quieres liberar la habitación tendrías que hacer:

SesionHabitacion.setActivo(habitacion.getCodigo(), true)

Esto es imaginando cómo puede ser, para verlo realmente habría que hacerlo viendo el código en sí.

Saludos!!

162
Si no sabes lo que quieres reparar, ni qué error es el que produce en el programa, ni cómo encontrar lo que quieres reparar... pues no veo cómo hacerlo. Otra cosa es si tienes un problema en el programa ¿Tienes algún problema en el programa (a la hora de su funcionamiento)?

163
Hola, yo en mi opinión personal no aprendería flash sino JavaScript y JQuery, pero eso no quiere decir que si lo deseas no puedas aprender flash. Creo que adobe flash player lo incorporan prácticamente todos los navegadores y que se seguirá usando, pero no como aspecto principal de las webs sino como algo secundario. Otras personas puede que sí recomienden aprender flash. Saludos!!

164
Hola! Si el programa no te marca error es que no lo detecta, lo recomendable si quieres poder volver a versiones anteriores es que vayas haciendo copias de seguridad cada cierto tiempo, por ejemplo cada 3 días. Saludos!!

165
Hola, pega el código del programa donde te surge el problema para intentar ejecutarlo y ver si el problema se reproduce al ejecutarlo en otro pc, de esta forma podrás tratar de hacer averiguaciones. Ten en cuenta que a veces un programa genera efectos colaterales que parecen asociados a una línea pero en realidad se deben a otra cosa. Saludos!!!

166
Aprender a programar desde cero / Re:Listas en app inventor
« en: 02 de Noviembre 2014, 14:26 »
No estoy seguro pero yo diría que no estás haciendo bien la eliminación del color de la lista.

Donde pones remove list item get global colores index Canvas1.BackgroundColor

supongo que quieres eliminar el color de la lista, pero Canvas1.BackgroundColor seguramente no te lo reconoce como el índice de la lista que quieres eliminar.

Creo que tendrías que usar

remove list item list global colores position in list canvas1.background color global colores

Con la idea de esta imagen:

167
Hola, pega por favor el código reestructurado, así colaboramos para ayudar a otras personas que estén haciendo algo parecido. Saludos!!!  ;D

168
Sí, si los conozco... Nosotros colaboramos con esta web por lo que los cursos que recomendamos son lo de esta web: http://aprenderaprogramar.com/index.php?option=com_content&view=article&id=57&Itemid=86, si colaborara con otra web recomendaría otros  ;D

169
Hola, no entiendo bien lo que quieres hacer. Plantea el código utilizando esta idea para ver qué es lo que quieres lograr viendo un ejemplo, pega el código para verlo y cuando lo vea intento cambiarlo para que en vez de ser un número fijo de listas pueda ser un número variable. Por ejemplo si tú creas el código y tienes dentro 4 listas, trataré de cambiarlo para que en vez de 4 puedas tener un número variable.

Saludos!!

170
Hola, sí se nota que estás mejorando, pero de lo que no estoy seguro es de si estás aprendiendo con buenos materiales. ¿Estás siguiendo un libro o una página web, o es una asignatura...?

El código no se ve excesivamente largo, no tienes que obsesionarte por hacerlo todo muy corto (aunque tampoco debes hacerlo más largo de lo necesario).

Has escrito while (true), esto en general no es una sentencia adecuada excepto en casos muy concretos. Puedes leer sobre esto en https://www.aprenderaprogramar.com/foros/index.php?topic=1022.msg5803#msg5803

Saludos!!

171
Sí puedes hacerlo, aunque posiblemente no sea muy aconsejable porque te puedes liar.

Este es un ejemplo de lista compuesta por listas...

Código: [Seleccionar]
import java.util.List;
import java.util.ArrayList;

public class Test1 {
    public static void main(String[] args) {
        List<ArrayList> miLista = new ArrayList<ArrayList> ();
        ArrayList<String> lista1 = new ArrayList<String>();
        ArrayList<String> lista2 = new ArrayList<String>();
        miLista.add(lista1);
        miLista.add(lista2);
        System.out.println("miLista es una lista que dentro tiene "+miLista.size() + " listas");
    }
}

Al ejecutarlo a mí me sale: miLista es una lista que dentro tiene 2 listas

Saludos!!

172
Hola, la "aletoriedad" cuando se generan números en un computador no es tan simple como parece porque la ejecución de las máquinas es determinista, es decir, en teoría siempre te debe llevar a un mismo resultado.

El problema puede estar relacionado con que estás creando una instancia de Random en cada repetición del bucle for, con lo cual no permites que una semilla genere aleatoriedad, sino que en cada pasada vuelves a crear la semilla y por eso te vuelve a repetir los números. Prueba a sacar esa parte del código del bucle, o sea:

Código: [Seleccionar]
Random rnd1 = new Random();

for (int i = 0; i < numerosIngresar; i++)
            {
 
               
                numeroArray[i] =rnd1.Next(5000) ;
 
            }

A ver si te funciona!!

173
Gracias a tí por compartir el código!!!

174
Continuación del código del ejemplo:

CLASE CIRCULO

Código: [Seleccionar]
import java.awt.*;
import java.awt.geom.*;

/**
 * A circle that can be manipulated and that draws itself on a canvas.
 */

public class Circle
{
    private int diameter;
    private int xPosition;
    private int yPosition;
    private String color;
    private boolean isVisible;

    /**
     * Create a new circle at default position with default color.
     */
    public Circle()
    {
        diameter = 40;
        xPosition = 20;
        yPosition = 60;
        color = "blue";
        isVisible = false;
    }

    /**
     * Make this circle visible. If it was already visible, do nothing.
     */
    public void makeVisible()
    {
        isVisible = true;
        draw();
    }

    /**
     * Make this circle invisible. If it was already invisible, do nothing.
     */
    public void makeInvisible()
    {
        erase();
        isVisible = false;
    }

    /**
     * Move the circle a few pixels to the right.
     */
    public void moveRight()
    {
        moveHorizontal(20);
    }

    /**
     * Move the circle a few pixels to the left.
     */
    public void moveLeft()
    {
        moveHorizontal(-20);
    }

    /**
     * Move the circle a few pixels up.
     */
    public void moveUp()
    {
        moveVertical(-20);
    }

    /**
     * Move the circle a few pixels down.
     */
    public void moveDown()
    {
        moveVertical(20);
    }

    /**
     * Move the circle horizontally by 'distance' pixels.
     */
    public void moveHorizontal(int distance)
    {
        erase();
        xPosition += distance;
        draw();
    }

    /**
     * Move the circle vertically by 'distance' pixels.
     */
    public void moveVertical(int distance)
    {
        erase();
        yPosition += distance;
        draw();
    }

    /**
     * Slowly move the circle horizontally by 'distance' pixels.
     */
    public void slowMoveHorizontal(int distance)
    {
        int delta;

        if(distance < 0)
        {
            delta = -1;
            distance = -distance;
        }
        else
        {
            delta = 1;
        }

        for(int i = 0; i < distance; i++)
        {
            xPosition += delta;
            draw();
        }
    }

    /**
     * Slowly move the circle vertically by 'distance' pixels.
     */
    public void slowMoveVertical(int distance)
    {
        int delta;

        if(distance < 0)
        {
            delta = -1;
            distance = -distance;
        }
        else
        {
            delta = 1;
        }

        for(int i = 0; i < distance; i++)
        {
            yPosition += delta;
            draw();
        }
    }

    /**
     * Change the size to the new size (in pixels). Size must be >= 0.
     */
    public void changeSize(int newDiameter)
    {
        erase();
        diameter = newDiameter;
        draw();
    }

    /**
     * Change the color. Valid colors are "red", "yellow", "blue", "green",
     * "magenta" and "black".
     */
    public void changeColor(String newColor)
    {
        color = newColor;
        draw();
    }

    /**
     * Draw the circle with current specifications on screen.
     */
    private void draw()
    {
        if(isVisible) {
            Canvas canvas = Canvas.getCanvas();
            canvas.draw(this, color, new Ellipse2D.Double(xPosition, yPosition,
                    diameter, diameter));
            canvas.wait(10);
        }
    }

    /**
     * Erase the circle on screen.
     */
    private void erase()
    {
        if(isVisible) {
            Canvas canvas = Canvas.getCanvas();
            canvas.erase(this);
        }
    }
}




CLASE CUADRADO

Código: [Seleccionar]
import java.awt.*;

/**
 * A square that can be manipulated and that draws itself on a canvas.
 */

public class Square
{
    private int size;
    private int xPosition;
    private int yPosition;
    private String color;
    private boolean isVisible;

    /**
     * Create a new square at default position with default color.
     */
    public Square()
    {
        size = 30;
        xPosition = 60;
        yPosition = 50;
        color = "red";
        isVisible = false;
    }

    /**
     * Make this square visible. If it was already visible, do nothing.
     */
    public void makeVisible()
    {
        isVisible = true;
        draw();
    }
   
    /**
     * Make this square invisible. If it was already invisible, do nothing.
     */
    public void makeInvisible()
    {
        erase();
        isVisible = false;
    }
   
    /**
     * Move the square a few pixels to the right.
     */
    public void moveRight()
    {
        moveHorizontal(20);
    }

    /**
     * Move the square a few pixels to the left.
     */
    public void moveLeft()
    {
        moveHorizontal(-20);
    }

    /**
     * Move the square a few pixels up.
     */
    public void moveUp()
    {
        moveVertical(-20);
    }

    /**
     * Move the square a few pixels down.
     */
    public void moveDown()
    {
        moveVertical(20);
    }

    /**
     * Move the square horizontally by 'distance' pixels.
     */
    public void moveHorizontal(int distance)
    {
        erase();
        xPosition += distance;
        draw();
    }

    /**
     * Move the square vertically by 'distance' pixels.
     */
    public void moveVertical(int distance)
    {
        erase();
        yPosition += distance;
        draw();
    }

    /**
     * Slowly move the square horizontally by 'distance' pixels.
     */
    public void slowMoveHorizontal(int distance)
    {
        int delta;

        if(distance < 0)
        {
            delta = -1;
            distance = -distance;
        }
        else
        {
            delta = 1;
        }

        for(int i = 0; i < distance; i++)
        {
            xPosition += delta;
            draw();
        }
    }

    /**
     * Slowly move the square vertically by 'distance' pixels.
     */
    public void slowMoveVertical(int distance)
    {
        int delta;

        if(distance < 0)
        {
            delta = -1;
            distance = -distance;
        }
        else
        {
            delta = 1;
        }

        for(int i = 0; i < distance; i++)
        {
            yPosition += delta;
            draw();
        }
    }

    /**
     * Change the size to the new size (in pixels). Size must be >= 0.
     */
    public void changeSize(int newSize)
    {
        erase();
        size = newSize;
        draw();
    }

    /**
     * Change the color. Valid colors are "red", "yellow", "blue", "green",
     * "magenta" and "black".
     */
    public void changeColor(String newColor)
    {
        color = newColor;
        draw();
    }

    /**
     * Draw the square with current specifications on screen.
     */
    private void draw()
    {
        if(isVisible) {
            Canvas canvas = Canvas.getCanvas();
            canvas.draw(this, color,
                        new Rectangle(xPosition, yPosition, size, size));
            canvas.wait(10);
        }
    }

    /**
     * Erase the square on screen.
     */
    private void erase()
    {
        if(isVisible) {
            Canvas canvas = Canvas.getCanvas();
            canvas.erase(this);
        }
    }
}





CLASE TRIANGULO

Código: [Seleccionar]
import java.awt.*;

/**
 * A triangle that can be manipulated and that draws itself on a canvas.
 */

public class Triangle
{
    private int height;
    private int width;
    private int xPosition;
    private int yPosition;
    private String color;
    private boolean isVisible;

    /**
     * Create a new triangle at default position with default color.
     */
    public Triangle()
    {
        height = 30;
        width = 40;
        xPosition = 50;
        yPosition = 15;
        color = "green";
        isVisible = false;
    }

    /**
     * Make this triangle visible. If it was already visible, do nothing.
     */
    public void makeVisible()
    {
        isVisible = true;
        draw();
    }
   
    /**
     * Make this triangle invisible. If it was already invisible, do nothing.
     */
    public void makeInvisible()
    {
        erase();
        isVisible = false;
    }
   
    /**
     * Move the triangle a few pixels to the right.
     */
    public void moveRight()
    {
        moveHorizontal(20);
    }

    /**
     * Move the triangle a few pixels to the left.
     */
    public void moveLeft()
    {
        moveHorizontal(-20);
    }

    /**
     * Move the triangle a few pixels up.
     */
    public void moveUp()
    {
        moveVertical(-20);
    }

    /**
     * Move the triangle a few pixels down.
     */
    public void moveDown()
    {
        moveVertical(20);
    }

    /**
     * Move the triangle horizontally by 'distance' pixels.
     */
    public void moveHorizontal(int distance)
    {
        erase();
        xPosition += distance;
        draw();
    }

    /**
     * Move the triangle vertically by 'distance' pixels.
     */
    public void moveVertical(int distance)
    {
        erase();
        yPosition += distance;
        draw();
    }

    /**
     * Slowly move the triangle horizontally by 'distance' pixels.
     */
    public void slowMoveHorizontal(int distance)
    {
        int delta;

        if(distance < 0)
        {
            delta = -1;
            distance = -distance;
        }
        else
        {
            delta = 1;
        }

        for(int i = 0; i < distance; i++)
        {
            xPosition += delta;
            draw();
        }
    }

    /**
     * Slowly move the triangle vertically by 'distance' pixels.
     */
    public void slowMoveVertical(int distance)
    {
        int delta;

        if(distance < 0)
        {
            delta = -1;
            distance = -distance;
        }
        else
        {
            delta = 1;
        }

        for(int i = 0; i < distance; i++)
        {
            yPosition += delta;
            draw();
        }
    }

    /**
     * Change the size to the new size (in pixels). Size must be >= 0.
     */
    public void changeSize(int newHeight, int newWidth)
    {
        erase();
        height = newHeight;
        width = newWidth;
        draw();
    }

    /**
     * Change the color. Valid colors are "red", "yellow", "blue", "green",
     * "magenta" and "black".
     */
    public void changeColor(String newColor)
    {
        color = newColor;
        draw();
    }

    /**
     * Draw the triangle with current specifications on screen.
     */
    private void draw()
    {
        if(isVisible) {
            Canvas canvas = Canvas.getCanvas();
            int[] xpoints = { xPosition, xPosition + (width/2), xPosition - (width/2) };
            int[] ypoints = { yPosition, yPosition + height, yPosition + height };
            canvas.draw(this, color, new Polygon(xpoints, ypoints, 3));
            canvas.wait(10);
        }
    }

    /**
     * Erase the triangle on screen.
     */
    private void erase()
    {
        if(isVisible) {
            Canvas canvas = Canvas.getCanvas();
            canvas.erase(this);
        }
    }
}

175
Hola, si eres principiante java este curso es el más recomendable: http://aprenderaprogramar.com/index.php?option=com_content&view=category&id=68&Itemid=188

El código siguiente es un código de ejemplo de un libro de aprendizaje Java con alguna modificación. Ejecuta el main de la clase test para ver el movimiento de un círculo:


CLASE TEST

Código: [Seleccionar]
public class test {
public static void main (String[] Args) {
    Picture p = new Picture();
    p.draw();
    p.hacerAtardecer();
}
}


CLASE CANVAS
Código: [Seleccionar]
import javax.swing.*;
import java.awt.*;
import java.util.List;
import java.util.*;

/**
 * Canvas is a class to allow for simple graphical drawing on a canvas.
 */
public class Canvas
{
    // Note: The implementation of this class (specifically the handling of
    // shape identity and colors) is slightly more complex than necessary. This
    // is done on purpose to keep the interface and instance fields of the
    // shape objects in this project clean and simple for educational purposes.

    private static Canvas canvasSingleton;

    /**
     * Factory method to get the canvas singleton object.
     */
    public static Canvas getCanvas()
    {
        if(canvasSingleton == null) {
            canvasSingleton = new Canvas("BlueJ Shapes Demo", 600, 600,
                                         Color.white);
        }
        canvasSingleton.setVisible(true);
        return canvasSingleton;
    }

    //  ----- instance part -----

    private JFrame frame;
    private CanvasPane canvas;
    private Graphics2D graphic;
    private Color backgroundColor;
    private Image canvasImage;
    private List<Object> objects;
    private HashMap<Object, ShapeDescription> shapes;
   
    /**
     * Create a Canvas.
     * @param title    title to appear in Canvas Frame
     * @param width    the desired width for the canvas
     * @param height   the desired height for the canvas
     * @param bgColor the desired background color of the canvas
     */
    private Canvas(String title, int width, int height, Color bgColor)
    {
        frame = new JFrame();
        canvas = new CanvasPane();
        frame.setContentPane(canvas);
        frame.setTitle(title);
        canvas.setPreferredSize(new Dimension(width, height));
        backgroundColor = bgColor;
        frame.pack();
        objects = new ArrayList<Object>();
        shapes = new HashMap<Object, ShapeDescription>();
    }

    /**
     * Set the canvas visibility and brings canvas to the front of screen
     * when made visible. This method can also be used to bring an already
     * visible canvas to the front of other windows.
     * @param visible  boolean value representing the desired visibility of
     * the canvas (true or false)
     */
    public void setVisible(boolean visible)
    {
        if(graphic == null) {
            // first time: instantiate the offscreen image and fill it with
            // the background color
            Dimension size = canvas.getSize();
            canvasImage = canvas.createImage(size.width, size.height);
            graphic = (Graphics2D)canvasImage.getGraphics();
            graphic.setColor(backgroundColor);
            graphic.fillRect(0, 0, size.width, size.height);
            graphic.setColor(Color.black);
        }
        frame.setVisible(visible);
    }

    /**
     * Draw a given shape onto the canvas.
     * @param  referenceObject  an object to define identity for this shape
     * @param  color            the color of the shape
     * @param  shape            the shape object to be drawn on the canvas
     */
     // Note: this is a slightly backwards way of maintaining the shape
     // objects. It is carefully designed to keep the visible shape interfaces
     // in this project clean and simple for educational purposes.
    public void draw(Object referenceObject, String color, Shape shape)
    {
        objects.remove(referenceObject);   // just in case it was already there
        objects.add(referenceObject);      // add at the end
        shapes.put(referenceObject, new ShapeDescription(shape, color));
        redraw();
    }
 
    /**
     * Erase a given shape's from the screen.
     * @param  referenceObject  the shape object to be erased
     */
    public void erase(Object referenceObject)
    {
        objects.remove(referenceObject);   // just in case it was already there
        shapes.remove(referenceObject);
        redraw();
    }

    /**
     * Set the foreground color of the Canvas.
     * @param  newColor   the new color for the foreground of the Canvas
     */
    public void setForegroundColor(String colorString)
    {
        if(colorString.equals("red")) {
            graphic.setColor(Color.red);
        }
        else if(colorString.equals("black")) {
            graphic.setColor(Color.black);
        }
        else if(colorString.equals("blue")) {
            graphic.setColor(Color.blue);
        }
        else if(colorString.equals("yellow")) {
            graphic.setColor(Color.yellow);
        }
        else if(colorString.equals("green")) {
            graphic.setColor(Color.green);
        }
        else if(colorString.equals("magenta")) {
            graphic.setColor(Color.magenta);
        }
        else if(colorString.equals("white")) {
            graphic.setColor(Color.white);
        }
        else {
            graphic.setColor(Color.black);
        }
    }

    /**
     * Wait for a specified number of milliseconds before finishing.
     * This provides an easy way to specify a small delay which can be
     * used when producing animations.
     * @param  milliseconds  the number
     */
    public void wait(int milliseconds)
    {
        try
        {
            Thread.sleep(milliseconds);
        }
        catch (Exception e)
        {
            // ignoring exception at the moment
        }
    }

    /**
     * Redraw ell shapes currently on the Canvas.
     */
    private void redraw()
    {
        erase();
        for(Object shape : objects) {
            shapes.get(shape).draw(graphic);
        }
        canvas.repaint();
    }
       
    /**
     * Erase the whole canvas. (Does not repaint.)
     */
    private void erase()
    {
        Color original = graphic.getColor();
        graphic.setColor(backgroundColor);
        Dimension size = canvas.getSize();
        graphic.fill(new Rectangle(0, 0, size.width, size.height));
        graphic.setColor(original);
    }


    /************************************************************************
     * Inner class CanvasPane - the actual canvas component contained in the
     * Canvas frame. This is essentially a JPanel with added capability to
     * refresh the image drawn on it.
     */
    private class CanvasPane extends JPanel
    {
        public void paint(Graphics g)
        {
            g.drawImage(canvasImage, 0, 0, null);
        }
    }
   
    /************************************************************************
     * Inner class CanvasPane - the actual canvas component contained in the
     * Canvas frame. This is essentially a JPanel with added capability to
     * refresh the image drawn on it.
     */
    private class ShapeDescription
    {
        private Shape shape;
        private String colorString;

        public ShapeDescription(Shape shape, String color)
        {
            this.shape = shape;
            colorString = color;
        }

        public void draw(Graphics2D graphic)
        {
            setForegroundColor(colorString);
            graphic.fill(shape);
        }
    }

}




CLASE DIBUJO

Código: [Seleccionar]
public class Picture
{
    private Square wall;
    private Square window;
    private Triangle roof;
    private Circle sun;

    /**
     * Constructor for objects of class Picture
     */
    public Picture()
    {
        // nothing to do... instance variables are automatically set to null
    }

    /**
     * Draw this picture.
     */
    public void draw()
    {
        wall = new Square();
        wall.moveVertical(80);
        wall.changeSize(100);
        wall.makeVisible();

        window = new Square();
        window.changeColor("black");
        window.moveHorizontal(20);
        window.moveVertical(100);
        window.makeVisible();

        roof = new Triangle(); 
        roof.changeSize(50, 140);
        roof.moveHorizontal(60);
        roof.moveVertical(70);
        roof.makeVisible();

        sun = new Circle();
        sun.changeColor("yellow");
        sun.moveHorizontal(180);
        sun.moveVertical(-10);
        sun.changeSize(60);
        sun.makeVisible();

    }
    /**
     * Change this picture to black/white display
     */
    public void setBlackAndWhite()
    {
        if(wall != null)   // only if it's painted already...
        {
            wall.changeColor("black");
            window.changeColor("white");
            roof.changeColor("black");
            sun.changeColor("black");
        }
    }

    /**
     * Change this picture to use color display
     */
    public void setColor()
    {
        if(wall != null)   // only if it's painted already...
        {
            wall.changeColor("red");
            window.changeColor("black");
            roof.changeColor("green");
            sun.changeColor("yellow");
        }
    }

    /**
     * Genera un efecto atardecer haciendo bajar el sol
     */
    public void hacerAtardecer()
    {
        if(wall != null)   // only if it's painted already...
        {
            sun.slowMoveVertical(150);
        }
    }
}

Continúa en el siguiente post -- >

176
Hola Emma, si estás flojo con recursividad lo primero sería comprender y hacer el ejemplo clásico del factorial.

Concepto de recursividad: https://www.aprenderaprogramar.com/foros/index.php?topic=1493.0

Luego hacer y comprender árboles binarios:

Arboles binarios recursivos en java: https://www.aprenderaprogramar.com/foros/index.php?topic=1367.0

Luego trabajo con conceptos dentro de árboles binarios:

Trabajo con niveles en árboles recursivos: https://www.aprenderaprogramar.com/foros/index.php?topic=1428.0

Y finalmente resolver el ejercicio que te piden

Saludos!!

177
Hola, el ejercicio está bien resuelto pero cuando se piden este tipo de ejercicios no suele ser para que se utilicen métodos como Array.Sort sino para que el propio alumno implemente su método de ordenación. Por ejemplo como se explica en http://aprenderaprogramar.com/index.php?option=com_content&view=article&id=183:ejercicio-ejemplo-estrategia-resolucion-problema-de-programacion-ordenar-serie-de-numeros-i-cu00119a-&catid=28:curso-bases-programacion-nivel-i&Itemid=59

Depende de lo que te pidan, si simplemente te piden que lo resuelvas, está bien. En cambio si te piden que lo implementes tú tendrías que definir tú cuál es el método de ordenación con instrucciones definidas por tí, y no usar Array.Sort

Saludos!!

178
Set the current cell to the cell in column 1, Row 0 es un comentario, por tanto esa línea tiene que empezar con un apóstrofe de comentario, o bien eliminarla.

'Set the current cell to the cell in column x, Row y (o eliminar la línea)

Saludos

179
Pienso que lo puedes solucionar de esta manera: antes de hacer la actualización, guarda la posición (la celda en la que te encuentras, por ejemplo la celda 4,6)

Una vez termina la actualización usa CurrentCell indicando cuál es la celda que debe ser la celda actual:

Código: [Seleccionar]
Private Sub setCurrentCellButton_Click(ByVal sender As Object, _
    ByVal e As System.EventArgs) Handles setCurrentCellButton.Click

    ' Set the current cell to the cell in column 1, Row 0. 
    Me.dataGridView1.CurrentCell = Me.dataGridView1(4, 6)

End Sub

Saludos!!

180
Creo que se deba a que haya que adaptar la sintaxis para la versión de Visual Basic que se esté utilizando. Según la versión de Visual Basic que se utilice es necesario hacer algunas adaptaciones. Aquí he dejado un ejemplo con Visual Basic 2012 y base de datos Access: https://www.aprenderaprogramar.com/foros/index.php?topic=1504.0

Saludos!!

Páginas: 1 ... 4 5 6 7 8 [9] 10 11 12 13 14 ... 24

Sobre la educación, sólo puedo decir que es el tema más importante en el que nosotros, como pueblo, debemos involucrarnos.

Abraham Lincoln (1808-1865) Presidente estadounidense.

aprenderaprogramar.com: Desde 2006 comprometidos con la didáctica y divulgación de la programación

Preguntas y respuestas

¿Cómo establecer o cambiar la imagen asociada (avatar) de usuario?
  1. Inicia sesión con tu nombre de usuario y contraseña.
  2. Pulsa en perfil --> perfil del foro
  3. Elige la imagen personalizada que quieras usar. Puedes escogerla de una galería de imágenes o subirla desde tu ordenador.
  4. En la parte final de la página pulsa el botón "cambiar perfil".