none
sendkeys RRS feed

  • Pregunta

  • Buenas tardes como estan? bueno estoy utilizando sendkeys para simular un teclado numerico en un form , utilizo botones para el teclado numerico y simplemente pongo en focus un textbox y manda la tecla deseada , el tema es el siguiente como tendria que hacer para que cualquier textbox que aprete o cualquier control me funcione ese teclado numerico ???Utilizo vs 2017 y vb.net.

    saludos y gracias de antemano

    viernes, 18 de octubre de 2019 19:28

Respuestas

  • Luego del mamarachito que me mande.... te muesto el avance del teclado, me falta tiempo pero tu lo puedes completar. La primer línea del teclado quedaría así, si te sivre acomodas el resto de las teclas de caracteres, para seguir desarrollando tenemos los caracteres especiales  Mayusculas Tab Delete y demas eso si tendrá que in en Sendkeys pero bueno por ahora está así. Solo para la primer linea de teclas alfanumericas

    Public Class Form1
        Public Boton As String = ""
        Public Check As String = ""
        Public Nombre As String = ""


        Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            Form2.Show()
        End Sub


        Private Sub Button14_Click(sender As Object, e As EventArgs) Handles Button14.Click
            Boton = Button14.Text
            Tsender()

        End Sub
    Private Sub Tsender()
            For Each Control As Control In Form2.Controls.OfType(Of TextBox)()

                If Control.Name = Nombre Then
                    For Each Button As Control In Panel1.Controls.OfType(Of Button)()
                        Control.Text += Boton

                        Exit For
                    Next

                    Exit Sub
                End If
            Next
        End Sub

        Private Sub Button15_Click(sender As Object, e As EventArgs) Handles Button15.Click
            Boton = Button15.Text
            Tsender()
        End Sub

        Private Sub Button16_Click(sender As Object, e As EventArgs) Handles Button16.Click
            Boton = Button16.Text
            Tsender()
        End Sub

        Private Sub Button17_Click(sender As Object, e As EventArgs) Handles Button17.Click
            Boton = Button17.Text
            Tsender()
        End Sub

        Private Sub Button18_Click(sender As Object, e As EventArgs) Handles Button18.Click
            Boton = Button18.Text
            Tsender()
        End Sub

        Private Sub Button19_Click(sender As Object, e As EventArgs) Handles Button19.Click
            Boton = Button19.Text
            Tsender()
        End Sub

        Private Sub Button20_Click(sender As Object, e As EventArgs) Handles Button20.Click
            Boton = Button20.Text
            Tsender()
        End Sub

        Private Sub Button24_Click(sender As Object, e As EventArgs) Handles Button24.Click
            Boton = Button24.Text
            Tsender()

        End Sub

        Private Sub Button23_Click(sender As Object, e As EventArgs) Handles Button23.Click
            Boton = Button23.Text
            Tsender()
        End Sub

        Private Sub Button22_Click(sender As Object, e As EventArgs) Handles Button22.Click
            Boton = Button22.Text
            Tsender()
        End Sub

        Private Sub CheckBox1_CheckStateChanged(sender As Object, e As EventArgs) Handles CheckBox1.CheckStateChanged
            If CheckBox1.CheckState = CheckState.Checked Then
                Nombre = "TextBox1"
                Check = sender.name
                Checker()

            End If
        End Sub

        Private Sub CheckBox2_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox2.CheckedChanged
            If CheckBox2.CheckState = CheckState.Checked Then
                Nombre = "TextBox2"
                Check = sender.name
                Checker()

            End If
        End Sub

        Private Sub CheckBox3_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox3.CheckedChanged
            If CheckBox3.CheckState = CheckState.Checked Then
                Nombre = "TextBox3"
                Check = sender.name
                Checker()

            End If
        End Sub

        Private Sub CheckBox4_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox4.CheckedChanged
            If CheckBox4.CheckState = CheckState.Checked Then
                Nombre = "TextBox4"
                Check = sender.name
                Checker()

            End If
        End Sub

        Private Sub CheckBox5_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox5.CheckedChanged
            If CheckBox5.CheckState = CheckState.Checked Then
                Nombre = "TextBox5"
                Check = sender.name
                Checker()

            End If
        End Sub

        Private Sub CheckBox6_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox6.CheckedChanged
            If CheckBox6.CheckState = CheckState.Checked Then
                Nombre = "TextBox6"
                Check = sender.name
                Checker()


            End If
        End Sub


        Private Sub Button14_MouseUp(sender As Object, e As MouseEventArgs) Handles Button14.MouseUp
            Label1.BackColor = Color.Transparent
        End Sub

        Private Sub Button14_MouseDown(sender As Object, e As MouseEventArgs) Handles Button14.MouseDown
            Label1.BackColor = Color.LightSkyBlue
        End Sub

        Private Sub Button15_MouseDown(sender As Object, e As MouseEventArgs) Handles Button15.MouseDown
            Label2.BackColor = Color.LightSkyBlue
        End Sub

        Private Sub Button15_MouseUp(sender As Object, e As MouseEventArgs) Handles Button15.MouseUp
            Label2.BackColor = Color.Transparent
        End Sub

        Private Sub Button16_MouseDown(sender As Object, e As MouseEventArgs) Handles Button16.MouseDown
            Label3.BackColor = Color.LightSkyBlue
        End Sub

        Private Sub Button16_MouseUp(sender As Object, e As MouseEventArgs) Handles Button16.MouseUp
            Label3.BackColor = Color.Transparent
        End Sub

        Private Sub Button17_MouseDown(sender As Object, e As MouseEventArgs) Handles Button17.MouseDown
            Label4.BackColor = Color.LightSkyBlue
        End Sub

        Private Sub Button17_MouseUp(sender As Object, e As MouseEventArgs) Handles Button17.MouseUp
            Label4.BackColor = Color.Transparent
        End Sub

        Private Sub Checker()
            For Each tilde As CheckBox In Me.Controls.OfType(Of CheckBox)()
                If Not tilde.Name = Check Then

                    tilde.CheckState = CheckState.Unchecked

                End If
            Next
        End Sub

        Private Sub Button18_MouseDown(sender As Object, e As MouseEventArgs) Handles Button18.MouseDown
            Label5.BackColor = Color.LightSkyBlue
        End Sub

        Private Sub Button18_MouseUp(sender As Object, e As MouseEventArgs) Handles Button18.MouseUp
            Label5.BackColor = Color.Transparent
        End Sub

        Private Sub Button19_MouseDown(sender As Object, e As MouseEventArgs) Handles Button19.MouseDown
            Label6.BackColor = Color.LightSkyBlue
        End Sub

        Private Sub Button19_MouseUp(sender As Object, e As MouseEventArgs) Handles Button19.MouseUp
            Label6.BackColor = Color.Transparent
        End Sub
        Private Sub Button20_MouseDown(sender As Object, e As MouseEventArgs) Handles Button20.MouseDown
            Label7.BackColor = Color.LightSkyBlue
        End Sub

        Private Sub Button20_MouseUp(sender As Object, e As MouseEventArgs) Handles Button20.MouseUp
            Label7.BackColor = Color.Transparent
        End Sub

        Private Sub Button24_MouseDown(sender As Object, e As MouseEventArgs) Handles Button24.MouseDown
            Label8.BackColor = Color.LightSkyBlue
        End Sub

        Private Sub Button24_MouseUp(sender As Object, e As MouseEventArgs) Handles Button24.MouseUp
            Label8.BackColor = Color.Transparent
        End Sub

        Private Sub Button23_MouseDown(sender As Object, e As MouseEventArgs) Handles Button23.MouseDown
            Label9.BackColor = Color.LightSkyBlue
        End Sub

        Private Sub Button23_MouseUp(sender As Object, e As MouseEventArgs) Handles Button23.MouseUp
            Label9.BackColor = Color.Transparent
        End Sub

        Private Sub Button22_MouseDown(sender As Object, e As MouseEventArgs) Handles Button22.MouseDown
            Label10.BackColor = Color.LightSkyBlue
        End Sub

        Private Sub Button22_MouseUp(sender As Object, e As MouseEventArgs) Handles Button22.MouseUp
            Label10.BackColor = Color.Transparent
        End Sub
    '----------------------------Espacio---------------------
        Private Sub Button21_Click(sender As Object, e As EventArgs) Handles Button21.Click
            Boton = " "
            Tsender()
        End Sub

    '-----------------------------------------------------------
    End Class

       

    Como ves es mucho trabajo y poco tiempo pero la idea, al menos para las alfanúmericas sería así. Revisa la lógica y pregunta lo que no entiendas, la idea es que se seleccione un chek para habilitar el  TextBox del Form2 y mediante funciones agregar texto .

    Aclaro que, si bien es mucho trabajo, es tecnología muy simple, de querer un verdadero teclado virtual se debería importar librerias y fuciones mucho mucho más elevadas con propiedades del sistema operativo muy complejas

    Saludos


    ARA San Juan 44 HEROES     ‗‗‗‗­|||||‗‗‗‗‗






    • Editado Marcelo PF martes, 22 de octubre de 2019 4:35
    • Propuesto como respuesta Pablo Rubio martes, 22 de octubre de 2019 14:42
    • Marcado como respuesta Pablo G Lopez martes, 22 de octubre de 2019 15:49
    martes, 22 de octubre de 2019 3:10

Todas las respuestas

  • Hola Pablo G Lopez

     

    Gracias por levantar tu consulta en los foros de MSDN. Con respecto a la misma,  te comento que para  que la comunidad de foros te pueda asesorar mejor, es necesario que nos compartas el form/code que estás desarrollando

     

     

    Gracias por usar los foros de MSDN.

     

    Pablo Rubio

     ____

     

    Por favor recuerde "Marcar como respuesta" las respuestas que hayan resuelto su problema, es una forma común de reconocer a aquellos que han ayudado, y hace que sea más fácil para los otros visitantes encontrar la solución más tarde. 

     

    Microsoft ofrece este servicio de forma gratuita, con la finalidad de ayudar a los usuarios y la ampliación de la base de datos de conocimientos relacionados con los productos y tecnologías de Microsoft.  

     

    Este contenido es proporcionado "tal cual" y no implica ninguna responsabilidad de parte de Microsoft.

    viernes, 18 de octubre de 2019 22:32
  • Hola

    intenta con esto

    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
    
        private string Nombre;
    
        private void Form1_Load(object sender, EventArgs e)
        {
            Nombre = textBox1.Name;
        }
    
        //mandas a esta funcion los eventos Click de los TextBox
        private void textBox_Click(object sender, EventArgs e)
        {
            Nombre = ((TextBox)sender).Name;
        }
    
        private void button1_Click(object sender, EventArgs e)
        {
            textBox1.Text = "";
            textBox2.Text = "";
            Controls[Nombre].Text = "Este";
        }
    }
    

    • Propuesto como respuesta Pablo Rubio martes, 22 de octubre de 2019 14:41
    sábado, 19 de octubre de 2019 2:29
  • Capaz no me explique bien :

     Private Sub num7_Click(sender As Object, e As EventArgs) Handles num7.Click
            txtcod.Focus()
            SendKeys.Send("7")
        End Sub

    con esto mando el 7 al textbox txtcod , lo que quiero saber como hacer , es mandar el 7 a cualquier textbox que clickee.

    Saludos

    domingo, 20 de octubre de 2019 2:37
  • Hola Pablo, tiene que ser Sendkeys? si no, puedes optar por ejmplo declarar un string a nivel formulario (Nombre) y en los eventos Enter de cada TextBox tomar el Name del mismo ej:

    Dim Nombre As String = ""
    '---------------------------------------
      Private Sub TextBox1_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.Enter
            Nombre = TextBox1.Name
        End Sub

    Para luego recorrer todos los TextBox y si encuenta su nombre colocar un valor a la porpiedad Text ej:

     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    
            For Each Control As Control In Me.Controls.OfType(Of TextBox)()
                If Control.Name = Nombre Then
                    Control.Text = "7"
    
                End If
    
            Next
        End Sub

     Así sea por ingresar con el mouse o mediante Tab tomará el nombre del que tenga el puntero en ese momento

    Saludos


    ARA San Juan 44 HEROES     ‗‗‗‗­|||||‗‗‗‗‗


    • Editado Marcelo PF domingo, 20 de octubre de 2019 16:50
    • Propuesto como respuesta Pablo Rubio martes, 22 de octubre de 2019 14:41
    domingo, 20 de octubre de 2019 16:49
  • Hola Pablo, tiene que ser Sendkeys? si no, puedes optar por ejmplo declarar un string a nivel formulario (Nombre) y en los eventos Enter de cada TextBox tomar el Name del mismo ej:

    Dim Nombre As String = ""
    '---------------------------------------
      Private Sub TextBox1_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.Enter
            Nombre = TextBox1.Name
        End Sub

    Para luego recorrer todos los TextBox y si encuenta su nombre colocar un valor a la porpiedad Text ej:

     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    
            For Each Control As Control In Me.Controls.OfType(Of TextBox)()
                If Control.Name = Nombre Then
                    Control.Text = "7"
    
                End If
    
            Next
        End Sub

     Así sea por ingresar con el mouse o mediante Tab tomará el nombre del que tenga el puntero en ese momento

    Saludos


    ARA San Juan 44 HEROES     ‗‗‗‗­|||||‗‗‗‗‗


    Gracias por el aporte , esto solamente me deja mandar un solo caracter , manda el 7 al textbox que entre pero no puedo agregar otros numero o otro 7 . Lo que quiero lograr es utilizarlo como un teclado tactil
    domingo, 20 de octubre de 2019 21:55
  • Ok ok, fijate de esta forma, solo cambia el código al evento Keydown del formulario

    Al código anterior solo cambia el evento en el button por el evento en el Form1 KeyDown

     Private Sub Form1_KeyDown(sender As Object, e As KeyEventArgs) Handles Me.KeyDown
            For Each Control As Control In Me.Controls.OfType(Of TextBox)()
                If Control.Name = Nombre Then
                    Control.Text += Int(e.KeyData)
    
                End If
    
            Next
        End Sub
    Saludos


    ARA San Juan 44 HEROES     ‗‗‗‗­|||||‗‗‗‗‗

    no hace nada :( , decime que estoy haciendo mal

     Private Sub txtcod_Enter(sender As Object, e As EventArgs) Handles txtcod.Enter
            Nombre = txtcod.Name
        End Sub

        Private Sub Form2_KeyDown(sender As Object, e As KeyEventArgs) Handles Me.KeyDown
            For Each Control As Control In Me.Controls.OfType(Of TextBox)()
                If Control.Name = Nombre Then
                    Control.Text += Int(e.KeyData)

                End If

            Next
        End Sub

        Private Sub num7_KeyDown(sender As Object, e As KeyEventArgs) Handles num7.KeyDown
            For Each Control As Control In Me.Controls.OfType(Of TextBox)()
                If Control.Name = Nombre Then
                    Control.Text = "7"

                End If

            Next

    me paro sobre el txtcod.text pero no hace nada

    lunes, 21 de octubre de 2019 2:01
  • Si disculpa es un error muy tonto de mi parte pensé que estába en el form2, joder perdona de nuevo. Lo sigo viendo

    ARA San Juan 44 HEROES     ‗‗‗‗­|||||‗‗‗‗‗

    lunes, 21 de octubre de 2019 2:49
  • Si disculpa es un error muy tonto de mi parte pensé que estába en el form2, joder perdona de nuevo. Lo sigo viendo

    ARA San Juan 44 HEROES     ‗‗‗‗­|||||‗‗‗‗‗

    Si no hay drama , te lo voy a agradecer.
    lunes, 21 de octubre de 2019 20:18
  • Luego del mamarachito que me mande.... te muesto el avance del teclado, me falta tiempo pero tu lo puedes completar. La primer línea del teclado quedaría así, si te sivre acomodas el resto de las teclas de caracteres, para seguir desarrollando tenemos los caracteres especiales  Mayusculas Tab Delete y demas eso si tendrá que in en Sendkeys pero bueno por ahora está así. Solo para la primer linea de teclas alfanumericas

    Public Class Form1
        Public Boton As String = ""
        Public Check As String = ""
        Public Nombre As String = ""


        Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            Form2.Show()
        End Sub


        Private Sub Button14_Click(sender As Object, e As EventArgs) Handles Button14.Click
            Boton = Button14.Text
            Tsender()

        End Sub
    Private Sub Tsender()
            For Each Control As Control In Form2.Controls.OfType(Of TextBox)()

                If Control.Name = Nombre Then
                    For Each Button As Control In Panel1.Controls.OfType(Of Button)()
                        Control.Text += Boton

                        Exit For
                    Next

                    Exit Sub
                End If
            Next
        End Sub

        Private Sub Button15_Click(sender As Object, e As EventArgs) Handles Button15.Click
            Boton = Button15.Text
            Tsender()
        End Sub

        Private Sub Button16_Click(sender As Object, e As EventArgs) Handles Button16.Click
            Boton = Button16.Text
            Tsender()
        End Sub

        Private Sub Button17_Click(sender As Object, e As EventArgs) Handles Button17.Click
            Boton = Button17.Text
            Tsender()
        End Sub

        Private Sub Button18_Click(sender As Object, e As EventArgs) Handles Button18.Click
            Boton = Button18.Text
            Tsender()
        End Sub

        Private Sub Button19_Click(sender As Object, e As EventArgs) Handles Button19.Click
            Boton = Button19.Text
            Tsender()
        End Sub

        Private Sub Button20_Click(sender As Object, e As EventArgs) Handles Button20.Click
            Boton = Button20.Text
            Tsender()
        End Sub

        Private Sub Button24_Click(sender As Object, e As EventArgs) Handles Button24.Click
            Boton = Button24.Text
            Tsender()

        End Sub

        Private Sub Button23_Click(sender As Object, e As EventArgs) Handles Button23.Click
            Boton = Button23.Text
            Tsender()
        End Sub

        Private Sub Button22_Click(sender As Object, e As EventArgs) Handles Button22.Click
            Boton = Button22.Text
            Tsender()
        End Sub

        Private Sub CheckBox1_CheckStateChanged(sender As Object, e As EventArgs) Handles CheckBox1.CheckStateChanged
            If CheckBox1.CheckState = CheckState.Checked Then
                Nombre = "TextBox1"
                Check = sender.name
                Checker()

            End If
        End Sub

        Private Sub CheckBox2_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox2.CheckedChanged
            If CheckBox2.CheckState = CheckState.Checked Then
                Nombre = "TextBox2"
                Check = sender.name
                Checker()

            End If
        End Sub

        Private Sub CheckBox3_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox3.CheckedChanged
            If CheckBox3.CheckState = CheckState.Checked Then
                Nombre = "TextBox3"
                Check = sender.name
                Checker()

            End If
        End Sub

        Private Sub CheckBox4_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox4.CheckedChanged
            If CheckBox4.CheckState = CheckState.Checked Then
                Nombre = "TextBox4"
                Check = sender.name
                Checker()

            End If
        End Sub

        Private Sub CheckBox5_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox5.CheckedChanged
            If CheckBox5.CheckState = CheckState.Checked Then
                Nombre = "TextBox5"
                Check = sender.name
                Checker()

            End If
        End Sub

        Private Sub CheckBox6_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox6.CheckedChanged
            If CheckBox6.CheckState = CheckState.Checked Then
                Nombre = "TextBox6"
                Check = sender.name
                Checker()


            End If
        End Sub


        Private Sub Button14_MouseUp(sender As Object, e As MouseEventArgs) Handles Button14.MouseUp
            Label1.BackColor = Color.Transparent
        End Sub

        Private Sub Button14_MouseDown(sender As Object, e As MouseEventArgs) Handles Button14.MouseDown
            Label1.BackColor = Color.LightSkyBlue
        End Sub

        Private Sub Button15_MouseDown(sender As Object, e As MouseEventArgs) Handles Button15.MouseDown
            Label2.BackColor = Color.LightSkyBlue
        End Sub

        Private Sub Button15_MouseUp(sender As Object, e As MouseEventArgs) Handles Button15.MouseUp
            Label2.BackColor = Color.Transparent
        End Sub

        Private Sub Button16_MouseDown(sender As Object, e As MouseEventArgs) Handles Button16.MouseDown
            Label3.BackColor = Color.LightSkyBlue
        End Sub

        Private Sub Button16_MouseUp(sender As Object, e As MouseEventArgs) Handles Button16.MouseUp
            Label3.BackColor = Color.Transparent
        End Sub

        Private Sub Button17_MouseDown(sender As Object, e As MouseEventArgs) Handles Button17.MouseDown
            Label4.BackColor = Color.LightSkyBlue
        End Sub

        Private Sub Button17_MouseUp(sender As Object, e As MouseEventArgs) Handles Button17.MouseUp
            Label4.BackColor = Color.Transparent
        End Sub

        Private Sub Checker()
            For Each tilde As CheckBox In Me.Controls.OfType(Of CheckBox)()
                If Not tilde.Name = Check Then

                    tilde.CheckState = CheckState.Unchecked

                End If
            Next
        End Sub

        Private Sub Button18_MouseDown(sender As Object, e As MouseEventArgs) Handles Button18.MouseDown
            Label5.BackColor = Color.LightSkyBlue
        End Sub

        Private Sub Button18_MouseUp(sender As Object, e As MouseEventArgs) Handles Button18.MouseUp
            Label5.BackColor = Color.Transparent
        End Sub

        Private Sub Button19_MouseDown(sender As Object, e As MouseEventArgs) Handles Button19.MouseDown
            Label6.BackColor = Color.LightSkyBlue
        End Sub

        Private Sub Button19_MouseUp(sender As Object, e As MouseEventArgs) Handles Button19.MouseUp
            Label6.BackColor = Color.Transparent
        End Sub
        Private Sub Button20_MouseDown(sender As Object, e As MouseEventArgs) Handles Button20.MouseDown
            Label7.BackColor = Color.LightSkyBlue
        End Sub

        Private Sub Button20_MouseUp(sender As Object, e As MouseEventArgs) Handles Button20.MouseUp
            Label7.BackColor = Color.Transparent
        End Sub

        Private Sub Button24_MouseDown(sender As Object, e As MouseEventArgs) Handles Button24.MouseDown
            Label8.BackColor = Color.LightSkyBlue
        End Sub

        Private Sub Button24_MouseUp(sender As Object, e As MouseEventArgs) Handles Button24.MouseUp
            Label8.BackColor = Color.Transparent
        End Sub

        Private Sub Button23_MouseDown(sender As Object, e As MouseEventArgs) Handles Button23.MouseDown
            Label9.BackColor = Color.LightSkyBlue
        End Sub

        Private Sub Button23_MouseUp(sender As Object, e As MouseEventArgs) Handles Button23.MouseUp
            Label9.BackColor = Color.Transparent
        End Sub

        Private Sub Button22_MouseDown(sender As Object, e As MouseEventArgs) Handles Button22.MouseDown
            Label10.BackColor = Color.LightSkyBlue
        End Sub

        Private Sub Button22_MouseUp(sender As Object, e As MouseEventArgs) Handles Button22.MouseUp
            Label10.BackColor = Color.Transparent
        End Sub
    '----------------------------Espacio---------------------
        Private Sub Button21_Click(sender As Object, e As EventArgs) Handles Button21.Click
            Boton = " "
            Tsender()
        End Sub

    '-----------------------------------------------------------
    End Class

       

    Como ves es mucho trabajo y poco tiempo pero la idea, al menos para las alfanúmericas sería así. Revisa la lógica y pregunta lo que no entiendas, la idea es que se seleccione un chek para habilitar el  TextBox del Form2 y mediante funciones agregar texto .

    Aclaro que, si bien es mucho trabajo, es tecnología muy simple, de querer un verdadero teclado virtual se debería importar librerias y fuciones mucho mucho más elevadas con propiedades del sistema operativo muy complejas

    Saludos


    ARA San Juan 44 HEROES     ‗‗‗‗­|||||‗‗‗‗‗






    • Editado Marcelo PF martes, 22 de octubre de 2019 4:35
    • Propuesto como respuesta Pablo Rubio martes, 22 de octubre de 2019 14:42
    • Marcado como respuesta Pablo G Lopez martes, 22 de octubre de 2019 15:49
    martes, 22 de octubre de 2019 3:10
  • Luego del mamarachito que me mande.... te muesto el avance del teclado, me falta tiempo pero tu lo puedes completar. La primer línea del teclado quedaría así, si te sivre acomodas el resto de las teclas de caracteres, para seguir desarrollando tenemos los caracteres especiales  Mayusculas Tab Delete y demas eso si tendrá que in en Sendkeys pero bueno por ahora está así. Solo para la primer linea de teclas alfanumericas

    Public Class Form1
        Public Boton As String = ""
        Public Check As String = ""
        Public Nombre As String = ""


        Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            Form2.Show()
        End Sub


        Private Sub Button14_Click(sender As Object, e As EventArgs) Handles Button14.Click
            Boton = Button14.Text
            Tsender()

        End Sub
    Private Sub Tsender()
            For Each Control As Control In Form2.Controls.OfType(Of TextBox)()

                If Control.Name = Nombre Then
                    For Each Button As Control In Panel1.Controls.OfType(Of Button)()
                        Control.Text += Boton

                        Exit For
                    Next

                    Exit Sub
                End If
            Next
        End Sub

        Private Sub Button15_Click(sender As Object, e As EventArgs) Handles Button15.Click
            Boton = Button15.Text
            Tsender()
        End Sub

        Private Sub Button16_Click(sender As Object, e As EventArgs) Handles Button16.Click
            Boton = Button16.Text
            Tsender()
        End Sub

        Private Sub Button17_Click(sender As Object, e As EventArgs) Handles Button17.Click
            Boton = Button17.Text
            Tsender()
        End Sub

        Private Sub Button18_Click(sender As Object, e As EventArgs) Handles Button18.Click
            Boton = Button18.Text
            Tsender()
        End Sub

        Private Sub Button19_Click(sender As Object, e As EventArgs) Handles Button19.Click
            Boton = Button19.Text
            Tsender()
        End Sub

        Private Sub Button20_Click(sender As Object, e As EventArgs) Handles Button20.Click
            Boton = Button20.Text
            Tsender()
        End Sub

        Private Sub Button24_Click(sender As Object, e As EventArgs) Handles Button24.Click
            Boton = Button24.Text
            Tsender()

        End Sub

        Private Sub Button23_Click(sender As Object, e As EventArgs) Handles Button23.Click
            Boton = Button23.Text
            Tsender()
        End Sub

        Private Sub Button22_Click(sender As Object, e As EventArgs) Handles Button22.Click
            Boton = Button22.Text
            Tsender()
        End Sub

        Private Sub CheckBox1_CheckStateChanged(sender As Object, e As EventArgs) Handles CheckBox1.CheckStateChanged
            If CheckBox1.CheckState = CheckState.Checked Then
                Nombre = "TextBox1"
                Check = sender.name
                Checker()

            End If
        End Sub

        Private Sub CheckBox2_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox2.CheckedChanged
            If CheckBox2.CheckState = CheckState.Checked Then
                Nombre = "TextBox2"
                Check = sender.name
                Checker()

            End If
        End Sub

        Private Sub CheckBox3_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox3.CheckedChanged
            If CheckBox3.CheckState = CheckState.Checked Then
                Nombre = "TextBox3"
                Check = sender.name
                Checker()

            End If
        End Sub

        Private Sub CheckBox4_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox4.CheckedChanged
            If CheckBox4.CheckState = CheckState.Checked Then
                Nombre = "TextBox4"
                Check = sender.name
                Checker()

            End If
        End Sub

        Private Sub CheckBox5_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox5.CheckedChanged
            If CheckBox5.CheckState = CheckState.Checked Then
                Nombre = "TextBox5"
                Check = sender.name
                Checker()

            End If
        End Sub

        Private Sub CheckBox6_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox6.CheckedChanged
            If CheckBox6.CheckState = CheckState.Checked Then
                Nombre = "TextBox6"
                Check = sender.name
                Checker()


            End If
        End Sub


        Private Sub Button14_MouseUp(sender As Object, e As MouseEventArgs) Handles Button14.MouseUp
            Label1.BackColor = Color.Transparent
        End Sub

        Private Sub Button14_MouseDown(sender As Object, e As MouseEventArgs) Handles Button14.MouseDown
            Label1.BackColor = Color.LightSkyBlue
        End Sub

        Private Sub Button15_MouseDown(sender As Object, e As MouseEventArgs) Handles Button15.MouseDown
            Label2.BackColor = Color.LightSkyBlue
        End Sub

        Private Sub Button15_MouseUp(sender As Object, e As MouseEventArgs) Handles Button15.MouseUp
            Label2.BackColor = Color.Transparent
        End Sub

        Private Sub Button16_MouseDown(sender As Object, e As MouseEventArgs) Handles Button16.MouseDown
            Label3.BackColor = Color.LightSkyBlue
        End Sub

        Private Sub Button16_MouseUp(sender As Object, e As MouseEventArgs) Handles Button16.MouseUp
            Label3.BackColor = Color.Transparent
        End Sub

        Private Sub Button17_MouseDown(sender As Object, e As MouseEventArgs) Handles Button17.MouseDown
            Label4.BackColor = Color.LightSkyBlue
        End Sub

        Private Sub Button17_MouseUp(sender As Object, e As MouseEventArgs) Handles Button17.MouseUp
            Label4.BackColor = Color.Transparent
        End Sub

        Private Sub Checker()
            For Each tilde As CheckBox In Me.Controls.OfType(Of CheckBox)()
                If Not tilde.Name = Check Then

                    tilde.CheckState = CheckState.Unchecked

                End If
            Next
        End Sub

        Private Sub Button18_MouseDown(sender As Object, e As MouseEventArgs) Handles Button18.MouseDown
            Label5.BackColor = Color.LightSkyBlue
        End Sub

        Private Sub Button18_MouseUp(sender As Object, e As MouseEventArgs) Handles Button18.MouseUp
            Label5.BackColor = Color.Transparent
        End Sub

        Private Sub Button19_MouseDown(sender As Object, e As MouseEventArgs) Handles Button19.MouseDown
            Label6.BackColor = Color.LightSkyBlue
        End Sub

        Private Sub Button19_MouseUp(sender As Object, e As MouseEventArgs) Handles Button19.MouseUp
            Label6.BackColor = Color.Transparent
        End Sub
        Private Sub Button20_MouseDown(sender As Object, e As MouseEventArgs) Handles Button20.MouseDown
            Label7.BackColor = Color.LightSkyBlue
        End Sub

        Private Sub Button20_MouseUp(sender As Object, e As MouseEventArgs) Handles Button20.MouseUp
            Label7.BackColor = Color.Transparent
        End Sub

        Private Sub Button24_MouseDown(sender As Object, e As MouseEventArgs) Handles Button24.MouseDown
            Label8.BackColor = Color.LightSkyBlue
        End Sub

        Private Sub Button24_MouseUp(sender As Object, e As MouseEventArgs) Handles Button24.MouseUp
            Label8.BackColor = Color.Transparent
        End Sub

        Private Sub Button23_MouseDown(sender As Object, e As MouseEventArgs) Handles Button23.MouseDown
            Label9.BackColor = Color.LightSkyBlue
        End Sub

        Private Sub Button23_MouseUp(sender As Object, e As MouseEventArgs) Handles Button23.MouseUp
            Label9.BackColor = Color.Transparent
        End Sub

        Private Sub Button22_MouseDown(sender As Object, e As MouseEventArgs) Handles Button22.MouseDown
            Label10.BackColor = Color.LightSkyBlue
        End Sub

        Private Sub Button22_MouseUp(sender As Object, e As MouseEventArgs) Handles Button22.MouseUp
            Label10.BackColor = Color.Transparent
        End Sub
    '----------------------------Espacio---------------------
        Private Sub Button21_Click(sender As Object, e As EventArgs) Handles Button21.Click
            Boton = " "
            Tsender()
        End Sub

    '-----------------------------------------------------------
    End Class

       

    Como ves es mucho trabajo y poco tiempo pero la idea, al menos para las alfanúmericas sería así. Revisa la lógica y pregunta lo que no entiendas, la idea es que se seleccione un chek para habilitar el  TextBox del Form2 y mediante funciones agregar texto .

    Aclaro que, si bien es mucho trabajo, es tecnología muy simple, de querer un verdadero teclado virtual se debería importar librerias y fuciones mucho mucho más elevadas con propiedades del sistema operativo muy complejas

    Saludos


    ARA San Juan 44 HEROES     ‗‗‗‗­|||||‗‗‗‗‗






    wow que laburo te mandaste , era lo que necesitaba lo modifique un poco el tema de los check pero aprendi la logica que necesitaba , te agradezco muchisimo!!!!! GRACIAS TOTALES!!!
    martes, 22 de octubre de 2019 15:51
  • De nada Pablo, agrego un button mayuscula y un Delete. Para mayusculas agrega un boolean True public  (M) y un button

      Private Sub Button25_Click(sender As Object, e As EventArgs) Handles Button25.Click
    
            For Each Butt As Button In Panel1.Controls.OfType(Of Button)()
                If Not Butt.Name = "Button25" AndAlso Not Butt.Name = "Button21" AndAlso Not Butt.Name = "Button13" And M = True Then
                    Label11.BackColor = Color.LightSkyBlue
                    Butt.Text = Butt.Text.ToUpper
    
                End If
                If Not Butt.Name = "Button25" AndAlso Not Butt.Name = "Button21" AndAlso Not Butt.Name = "Button13" And M = False Then
    
                    Butt.Text = Butt.Text.ToLower
                    Label11.BackColor = Panel1.BackColor
                End If
    
            Next
            If M Then
    
                M = False
            Else
    
                M = True
            End If
    
        End Sub

    Para el boton retorceder o eliminar DEL...

    Private Sub Button13_Click(sender As Object, e As EventArgs) Handles Button13.Click
    
            For Each Del As TextBox In Form2.Controls.OfType(Of TextBox)()
                If Del.Name = Nombre And Not Del.Text = "" Then
                    Del.Focus()
                    Del.SelectionStart = Len(Del.Text) - 1
                    SendKeys.SendWait("{DEL}")
                    Exit For
                End If
            Next
    
        End Sub
                          

                           


    ARA San Juan 44 HEROES     ‗‗‗‗­|||||‗‗‗‗‗


    • Editado Marcelo PF miércoles, 23 de octubre de 2019 6:35
    miércoles, 23 de octubre de 2019 4:23