Visual Basic 6.0 - Ejecutar una aplicación desde la Shell

Written by lopezatienza on 29 Octubre 2008 – 16:54 -



Dim lWait As Long

Dim bProceed As Boolean

Dim LRet As Long

Dim sMessage As String

Dim sPROCESS_INFORMATION As String

Dim hProcess As Long

Dim hThread As Long

Dim dwProcessId As Long

Dim dwThreadId As Long

Read more »


Tags:
Posted in Visual Basic 6.0 | No Comments »

ASP.NET - Aplicación Web Multidioma

Written by lopezatienza on 29 Octubre 2008 – 16:51 -


Para ello una vez que tengamos hecha la web, hacer doble click en la página que queremos hacer multidioma y en el menú herramientas darle a Generar recurso local se nos generará un archivo de recurso en la carpeta App_LocalResources parecido a Default.aspx.resx, ahora debemos copiar ese archivo, pegarlo y cambiarle el nombre a Default.aspx.es-es.resx, Default.aspx.en-us.resx, etc.

El que generó automáticamente será el predeterminado y a partir de ahí es para cada idioma, solo tenemos que editar el archivo de recursos de cada idioma para ser multidioma.

Al igual que en Windows Forms lo podemos hacer reutilizable.


Tags:
Posted in ASP.NET | No Comments »

ASP - Configurar aplicación web en IIS

Written by lopezatienza on 29 Octubre 2008 – 16:50 -

Hola a todos.
En este artículo voy a explicar cómo crear una aplicación Web en IIS.
Los pasos a seguir son los siguientes:

  1. Instalar IIS accediendo a Agregar o Quitar Programas del Panel de control
  2. Agregar o quitar componentes de Windows
  3. Seleccionar Servicios de Internet Information Server y pulsar Siguiente
  4. Copiar nuestro proyecto en la raíz de C:\Inetpub\wwwroot\
  5. Inicio\ejecutar -> inetmgr o Acceder a Panel de control \ Herramientas Administrativas \ Servicios de Internet Information Server
  6. Desde el arbol de consola acceder al equipo local \ Sitios Web \ Nuestroproyecto
  7. Boton derecho -> Propiedades
  8. En la pestaña de Directorio click en Crear
  9. Introducir el nombre de la aplicación como queramos
  10. Boton derecho -> Todas las tareas -> Asistente de permisos
  11. En la pantalla de Asistente de permisos realizamos:
  • Seleccionar la nueva configuración de seguridad desde una plantilla -> Siguiente
  • Seleccionar en Escenario: Public Web Site -> Siguiente
  • Reemplazar todos los permisos de directorios y archivos -> Siguiente
  • Aparece toda la configuración -> Siguiente
  • Finalizar

Un saludo y espero os sirva de ayuda.


Tags:
Posted in ASP | No Comments »

CSharp - Incrementar número hexadecimal

Written by lopezatienza on 29 Octubre 2008 – 16:47 -

Esta función te devuelve null si hay algún fallo.Si se le envía un String que está formado por valores numéricos devolverá 1 número mas de éste, incluído si es una letra de la A a la F, lo cual devolverá el valor siguiente.

       

public string IncrementarHexadecimal(string Numero)

        {

            try

            {

                int aux = Numero.Length;

                int i = 1;

                string Numero2 = "";

 

                while (Numero.Substring(aux - i, 1) == "F")

                {

                    Numero2 = "0" + Numero2;

                    i++;

                }

  Read more »


Tags: ,
Posted in CSharp | No Comments »

CSharp - Incrementar String como si fuera numerico

Written by lopezatienza on 29 Octubre 2008 – 16:46 -



Esta función te devuelve null si hay algún fallo, por ejemplo que se le pase una cadena con letras.Si se le envía un String que está formado por valores numéricos devolverá 1 número mas de éste.

public string Incrementar(string Numero)

        {

            try

            {

                int aux = Numero.Length;

                int i = 1;

                string Numero2 = "";

 

                while (Numero.Substring(aux - i, 1) == "9")

                {

                    Numero2 = "0" + Numero2;

                    i++;

                }

                Numero2 = Convert.ToString(Convert.ToInt32(Numero.Substring(aux - i, 1)) + 1) + Numero2;

                Numero2 = Numero.Substring(0, aux - i) + Numero2;

                return Numero2;

            }

            catch { return null; }

        }

Read more »


Tags: ,
Posted in CSharp | No Comments »

CSharp - Diferencia de Fechas

Written by lopezatienza on 29 Octubre 2008 – 16:44 -



Este ejemplo devolverá el total de segundos que hay de diferencia entre dos fechas:

 

       DateTime inicio = DateTime.Now;

        // EJECUCIÓN de un proceso

        DateTime final = DateTime.Now;

        TimeSpan duracion = final - inicio;

        double segundosTotales = duracion.TotalSeconds;        // Calcula la diferencia en segundos, por ejemplo si ha pasado 1:30 contará 90 segundos

        int segundos = duracion.Seconds;                               // Este es un error frecuente, ya que si ha pasado 1:30 segundos no contaría 90, sino 30


Posted in CSharp | No Comments »

CSharp - Formato de Fechas

Written by lopezatienza on 29 Octubre 2008 – 16:42 -


// Format : 07 / 03 / 2004

formattedDate = DateTime.Now.ToString("dd / MM / yyyy");

 

// Format : 7 / 3 / 2004 (without the preceding zeroes)

formattedDate = DateTime.Now.ToString("d / M / yyyy");

 

// Format : 07 / Mar / 2004

formattedDate = DateTime.Now.ToString("dd / MMM / yy");

 

// How to get the name of the day ?

// Format : Wednesday

formattedDate = DateTime.Today.DayOfWeek.ToString();

Read more »


Posted in CSharp | No Comments »

CSharp - Escribir en un fichero sin borrar lo existente

Written by lopezatienza on 29 Octubre 2008 – 16:37 -


System.IO.FileStream FS;

System.IO.StreamWriter SW;

 

 

string Fichero = Application.StartupPath + @"\Fichero.txt";

FS = new System.IO.FileStream(Fichero, System.IO.FileMode.Append, System.IO.FileAccess.Write);

SW = new System.IO.StreamWriter(FS);

SW.WriteLine("Texto que deseamos introducir");

SW.Close();


Posted in CSharp | No Comments »

CSharp - Leer archivos

Written by lopezatienza on 29 Octubre 2008 – 16:32 -

Crearemos un proyecto Windows Form en CSharp llamado LeerArchivo:

using System;

 

using System.IO;

class LeerArchivo {

    publicstaticvoid Main()

    {

Read more »


Tags: ,
Posted in CSharp | No Comments »

Visual Basic - Factorial de un numero Recursivo

Written by lopezatienza on 29 Octubre 2008 – 16:17 -

Primeramente crearemos nuestro proyecto.

Añadiremos 2 TextBox llamados "textbox1" y "textbox2".

Añadiremos un Button llamado "button1"



Añadiremos el siguiente código a nuestro "Form1.vb"

Public Class Form1

 

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim act, res As Double

        Dim ant As Integer

        act = textbox1.Text

        ant = act - 1

        Do

            res = fact(act, ant)

            act = res

            ant -= 1

        Loop While (ant > 0)

        textbox2.Text = res

    End Sub

 

    Private Function fact(ByVal act As Double, ByVal ant As Integer) As Double

        fact = act * ant

    End Function

 

End Class

Asociar el evento Click del botón Button1 a la función Button1_Click o añade el código directamente.

Un saludo y espero que os sirva de ayuda.


Tags:
Posted in Visual Basic .NET | 5 Comments »

Visual Basic - Timer manejando el evento Tick

Written by lopezatienza on 29 Octubre 2008 – 14:42 -


Primeramente crearemos nuestro proyecto.

Le cambiamos el tamaño de nuestro Form1 a: 435; 320

Agregaremos 2 botones llamados "btnon" y "btnoff".

Agregaremos un PictureBox llamado "balon" con la imagen que queramos.

Agregamos un Timer al que llamamos "Timer".

Introduciremos el siguiente código a nuestro "Form1.vb"

Read more »


Tags:
Posted in Visual Basic .NET | 3 Comments »

Visual Basic - Funcion recursiva Fibonacci

Written by lopezatienza on 29 Octubre 2008 – 14:33 -


Primeramente crearemos nuestro proyecto.

Agregamos un tipo Button llamado "btncalcular".

Agregamos un label llamado "lbserie".



Agregamos el siguiente código a "Form1.vb"

Read more »


Tags:
Posted in Visual Basic .NET | No Comments »

Visual Basic - Comprobar TextBox vacios

Written by lopezatienza on 29 Octubre 2008 – 14:26 -


Creamos nuestro Proyecto.

Agregamos 4 TextBox llamados: "tbnombre" , "tbdireccion" , "tbedad" , "tbtelefono"

Agregamos un Button llamado "btnaceptar"



Introducimos el siguiente código en "Form1.vb"

Read more »


Tags:
Posted in Visual Basic .NET | 2 Comments »

Visual Basic - Form cambia de Celtius a Fahrenheit

Written by lopezatienza on 29 Octubre 2008 – 12:50 -

 Crearemos un proyecto nuevo.Introducimos un TextBox llamado "tbcentigrados".

Introducimos un TextBox llamado "tbfahrenheit".

Introducimos un Button llamado "btcentigrados".

Introducimos un Button llamado "btfahnrenheit".

Introducimos un Button llamado "btnlimpiar".

http://www.lopezatienza.es/Imagenes/Fahrenheit.JPG


Read more »


Tags:
Posted in Visual Basic .NET | No Comments »

Visual Basic - Cambiar estilo del texto a un TextBox

Written by lopezatienza on 29 Octubre 2008 – 11:47 -


Primeramente crearemos un proyecto Application Form.

Le damos el nombre de "ventana" a nuestro formulario.

Crearemos un TextBox llamado "tbintro".

Un CheckBox llamado "cknegrita".

Un CheckBox llamado "cksubrayado".

Un CheckBox llamado "ckrojo".

Introduciremos el siguiente código en nuestro "Form1.vb"

Read more »


Tags:
Posted in Visual Basic .NET | No Comments »

Visual Basic - Llamada de varios eventos

Written by lopezatienza on 29 Octubre 2008 – 11:37 -


Veremos un ejemplo de las llamadas a varios eventos:Primeramente creamos un proyecto.
Le damos el nombre de "ventana" a nuestro Form1.

Introducimos un boton llamado "btn".

Copiamos y pegamos este código en el "Form1.vb".

Read more »


Tags:
Posted in Visual Basic .NET | No Comments »

Visual Basic - Clase IO

Written by lopezatienza on 29 Octubre 2008 – 11:33 -

IO.StreamWriter // nos permite I / S de archivos en dispositivos

SaveFileDialog .Title
.InitialDirectory
.Filter = " Literal \ *.doc \ Literal \ *.txt "
Literal == [ Documentos | Imagenes ]
.Filename
.DefaultExt
.CheckFileExists
.ValidateNames

Dim variable As IOStreamWriter
variable = new IOStreamWriter(SaveFileDialog1.FileName)
variable.Write(TBox.Text)
variable.close

Read more »


Tags:
Posted in Visual Basic .NET | No Comments »

ASP - Acceso a Base de datos Access

Written by lopezatienza on 29 Octubre 2008 – 10:49 -


ACCESO A BASES DE DATOS

1.CREAR UNA BASE DE DATOS USANDO MICROSOFT ACCESS 2000
2.COMUNICACIÓN CON BASES DE DATOS. COMPONENTES ADO

Creación de un DSN de sistema
El objeto CONNECTION
El objeto RECORDSET
El objeto COMMAND
3.INSTRUCCIONES SQL PARA CONSULTAR DATOS
La cláusula WHERE
La cláusula ORDER BY

Read more »


Posted in ASP | 8 Comments »

CSharp - Pulsación de teclas

Written by lopezatienza on 28 Octubre 2008 – 15:02 -

Para controlar la pulsación de teclas, se debe manejar el evento KeyPress.
Para saber que tecla se ha pulsado se usará el e.KeyChar.
Para que la pulsación quede invalidada o se quiera realizar una serie de métodos, pondremos la propiedad Handled así:

e.Handled = true;

private void txtNumero_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar != '1' && e.KeyChar != '2' && e.KeyChar != '3' && e.KeyChar != '4' && e.KeyChar != '5' && e.KeyChar != '6' && e.KeyChar != '7' && e.KeyChar != '8' && e.KeyChar != '9' && e.KeyChar != '0')
{
e.Handled = true; 'La tecla quedaría invalidada si no es numérica
}
}


Tags: ,
Posted in CSharp | No Comments »

CSharp - Confirmation Dialog Box ejemplo (ok, cancel)

Written by lopezatienza on 28 Octubre 2008 – 13:45 -


private void button1_Click(object sender, System.EventArgs e)

{

if

 (MessageBox.Show("¿Esta seguro?", "Mensaje Ventana", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
   {

            // Aquí entraría si devuelve DialogResult.Yes
   }
}


Tags: ,
Posted in CSharp | No Comments »
RSS