Results 1 to 13 of 13

Thread: VB.NET Change Any keypress by another on any where

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2021
    Posts
    158

    VB.NET Change Any keypress by another on any where

    I'm trying to make every time I press a key on the keyboard it is replaced by special symbols anscii:

    But in all textbox controls, richtexbox everything that can be entered a value.

    But I have a form2 called with: me.controls.add(form2)

    and also when I precionar selected in the second form that the same values ​​are valid for any.

    I thought of the following method:

    Create a module with all key definitions:

    Module:
    Code:
    Public sub keysubbcall()
    If e.keypress = Keys.A then
    Set selected.text = "AnciiCode112"
    end if
    
    If e.keypress = Keys.A then
    Set selected.text = "AnciiCode113"
    end if
    end sub
    So in the form's keydown call:

    Code:
    call module.kepress(keysubcall)
    But from what I thought it doesn't work well, I'd like it to work in all but only selected regardless of the form, even if it's an exe called done in vb being toplevel(false)

    is there any way to do this without using the method I've always done but always for something definite:

    Code:
    if e.keys = kepress.a then
    textbox1.text &= "Ancii112"
    end if
    But I would like it to work on any text input control.



    Code:
     Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    Form1.Keypreview = True
    End Sub
    
    ' Internet Ref:
    'REM : https://stackoverflow.com/questions/13727172/vb-net-keydown-event-on-whole-form
    '*************************************************************************
    Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As KeyEventArgs) Handles MyBase.KeyDown
        If  e.Control AndAlso e.KeyCode = Keys.S then
            ' Call your sub method here  .....
            YourSubToCall()
    
            ' then prevent the key to reach the current control
            e.Handled = False 
        End If
    End Sub
    Last edited by LiwisJames; Jul 13th, 2021 at 04:44 PM.

  2. #2
    Frenzied Member
    Join Date
    Feb 2003
    Posts
    1,402

    Re: VB.NET Change Any keypress by another on any where

    1. anscii does not exist. What kind of special extended ASCII symbols?
    2. Please use code tags.
    3. KeyPreview can be set at design time. The rest of that code appears to be meaningless.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Apr 2021
    Posts
    158

    Re: VB.NET Change Any keypress by another on any where

    Quote Originally Posted by Peter Swinkels View Post
    1. anscii does not exist. What kind of special extended ASCII symbols?
    2. Please use code tags.
    3. KeyPreview can be set at design time. The rest of that code appears to be meaningless.
    Sorry I got confused when writing it really is ASCII, well I want to insert characters with different numbers of representation so it doesn't need to be common characters besides I can see how the final result is.

    Yes I must use tag in the code, I just had separated the code to explain and forgot to add as you can see at the end I had placed it.

    The code makes sense well see use the logic is as follows when the key is pressed get the value of the textbox and add to the existing text the following ASCII.

    Look:
    Code:
    if e.keypress = "A" then
    
    textbox1.text &= "a" ' when used (&= ) it adds the equality of the new value to the text.
    
    end if

  4. #4
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,041

    Re: VB.NET Change Any keypress by another on any where

    I hope you are not native English speaker because I'm feeling that my English went up a notch.
    The code make no sense at all e.keypress? I propose you stick with assembly, you are better with it and you can do those thing more easily there.
    Speaking of assembly, I'm yet to see any sample of the OS you are preparing. Can we see some some samples and explanations?
    .

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Apr 2021
    Posts
    158

    Re: VB.NET Change Any keypress by another on any where

    Yes, I'm actually creating the concept in vb.net and I need to finish that, and then I need to start in assembly so I'm looking for a language that's simple or bouncy and quick to create as I would have to create memory controls again then vb.net is better to stop creating examples.
    Last edited by LiwisJames; Jul 13th, 2021 at 07:00 PM.

  6. #6
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,041

    Re: VB.NET Change Any keypress by another on any where

    Yes of course.
    .

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Apr 2021
    Posts
    158

    Re: VB.NET Change Any keypress by another on any where



    Attachment 181847

    See the SO concept.

  8. #8
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,041

    Re: VB.NET Change Any keypress by another on any where

    I better not.I'm not vaccinated.
    .

  9. #9

    Thread Starter
    Addicted Member
    Join Date
    Apr 2021
    Posts
    158

    Re: VB.NET Change Any keypress by another on any where

    I put only basic and concept functions I put existing ones and created some but it's too early to put them all. Then I just need to replicate it, so I need the key control when pressed, because I want to change the order of some characters on the keyboard, I think there's a way to change it directly in memory too, right?

  10. #10

    Thread Starter
    Addicted Member
    Join Date
    Apr 2021
    Posts
    158

    Re: VB.NET Change Any keypress by another on any where

    Quote Originally Posted by sapator View Post
    I better not.I'm not vaccinated.
    LOL LOL

    it's just a beta so I won't share it yet but when it's ready put on youtube, and I update, besides starting my OS assembly, I also have a brilliant idea to use this in GTK with linux.

  11. #11

    Thread Starter
    Addicted Member
    Join Date
    Apr 2021
    Posts
    158

    Re: VB.NET Change Any keypress by another on any where

    Quote Originally Posted by Peter Swinkels View Post
    1. anscii does not exist. What kind of special extended ASCII symbols?
    2. Please use code tags.
    3. KeyPreview can be set at design time. The rest of that code appears to be meaningless.
    I think the following use the keydowns when the key is pressed it will display the character I define anywhere is this possible? even if in a child form?

  12. #12
    Frenzied Member
    Join Date
    Feb 2003
    Posts
    1,402

    Re: VB.NET Change Any keypress by another on any where

    Quote Originally Posted by LiwisJames View Post
    I think the following use the keydowns when the key is pressed it will display the character I define anywhere is this possible? even if in a child form?
    Yes, using custom characters is possible. It's called using another font. How about creating a font yourself?

  13. #13

    Thread Starter
    Addicted Member
    Join Date
    Apr 2021
    Posts
    158

    Re: VB.NET Change Any keypress by another on any where

    Quote Originally Posted by Peter Swinkels View Post
    Yes, using custom characters is possible. It's called using another font. How about creating a font yourself?
    I only created fonts in two ways for a site a long time ago, and by eucedit, but in this case it is viable instead of using ascii. because it's just an example of what it would be like if you changed the font.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width