Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8730513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:02:25+00:00 2026-06-13T09:02:25+00:00

I have to rewrite some my old code from VB6 to VB.NET and here

  • 0

I have to rewrite some my old code from VB6 to VB.NET and here is some things I don’t know what to do.
For example I have to replace some keycodes under keyDown event handler of textbox and I can’t do this without help.

Most simple to say, I have workable VB6 code:

If KeyCode = vbKeyUp Then
   KeyCode = vbKeyEscape
End If

When I try to rewrite this literally:

If e.KeyCode = Keys.Up Then
   e.KeyCode = Keys.Escape
End if

But this won’t go:

Error 2 Property ‘KeyCode’ is ‘ReadOnly’.

Since I have much of such conversions to do is here any way to achieve this simple?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T09:02:26+00:00Added an answer on June 13, 2026 at 9:02 am

    The best way to simulate this in VB.Net is to do the following. When you see the Up key is pressed cancel the event. Then send an artificial key event for the Escape key.

    Protected Overrides Sub OnKeyDown(ByVal e As KeyEventArgs)
        If e.KeyCode = Keys.Up Then
            e.Handled = True
            SendKeys.Send("ESC")
        Else
            MyBase.OnKeyDown(e)
        End If
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm about to have to rewrite some rather old code using SQL Server's BULK
I'm trying to rewrite some old SQL into LINQ to SQL. I have a
I have some content that loads from Jade when page loads (for example, a
I'm trying to rewrite some old python code with requests module. The purpose is
I have old Delphi application. This app takes session key from server, do some
I'm trying to rewrite some query strings I have in my URL like this
I want to have URLs like this: some-company-name-deal-id-6.htm So the rewrite rule should ignore
Today I was reading code from some very popular numerical libraries written in FORTRAN
This is an attempt to rewrite some old homework using STL algorithms instead of
I have a WCF service that returns some JSON from a serialized object: public

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.