• 0

[VB.NET - HELP] Sending Numpad Key


 Share

Question

Hey everybody!

 

I faced some issues when I tried to send a numpad key.

SendKeys.Send({Numpad0}) doesn't work.

I also tried to change it to NumPad and NUMPAD, even to Num.

but nothing seems to work properly, how can I do that?

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0
4 hours ago, Lirbo said:

Hey everybody!

 

I faced some issues when I tried to send a numpad key.

SendKeys.Send({Numpad0}) doesn't work.

The parameter is a string. String literals in VB.NET are delimited by double-quotes, as in the Hello World example:

Console.WriteLine("Hello World!")

Therefore your code should be:

SendKeys.Send("{Numpad0}") 

By the way, your code didn't just "not work", it didn't "compile" and if you were working in Visual Studio, you had errors telling you something useful about why. Make sure to include this information in any question you ask about why your code "doesn't work".

 

Sans titre.png

  • Like 1
Link to comment
Share on other sites

This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By News Staff
      Learn AutoCAD Programming with this Certification Bundle for just $29.99
      by Steven Parker

      Today's highlighted deal comes via our Online Courses section of the Neowin Deals store where you can save 98% off this Learn AutoCAD Programming Certification Bundle. Become an AutoCAD Wizard with 67 hours of hands-on lectures on VBA, VB.NET, C#, AutoLISP, and C#.NET Programming.



      This bundle consists of the following courses:

      Learn AutoCAD Programming using VB.NET - Hands On!
      Gain Confidence to Create Your Own AutoCAD Plugin using VB.NET Programming AutoCAD VBA Programming - Beginner Course
      Gain a Solid Understanding of AutoCAD VBA Concepts & Fundamentals to Develop Your Own Applications AutoCAD to Excel - VBA Programming Hands-On!
      Learn How to Export & Import AutoCAD Drawings to Excel to Other Formats through VBA Programming AutoCAD Programming using C# with Windows Forms
      Learn AutoCAD Programming through C# by Developing Real World Applications Develop AutoCAD Plugins using VB.NET with Windows Forms
      Pick Up How to Develop AutoCAD Plugins using VB.NET with Windows Forms Programming AutoCAD to Excel using VB.NET - Hands-On!
      Develop AutoCAD Plugins that integrate with Excel & Text Files using VB.NET Practical AutoLISP Programming - Beginner to Advanced
      Learn from This Ultimate AutoLISP Programming Guide with Lots of Sample Programs AutoCAD Programming using C#.NET - Beginner Course
      Master The Fundamentals of C# Programming & Create AutoCAD Objects Through this Ultimate Guide Here's the deal:
      This Learn AutoCAD Programming Certification Bundle normally costs $1600 but it can be yours for just $29.99 for a limited time, that's a saving of $1570.01 (98%) off the price. For a full description, specs, and instructor info please click the link below.

      Learn AutoCAD Programming Certification Bundle just $29.99
      Save 13% off this 20W Mini USB-C PD Charger
      From 0 to 50% in Just 30 Minutes! Fast Charge Your iOS Device on Any Plug with This 20W Charger, Plus an Extra USB-C PD to Lightning Cable.

      Get the ZeroLemon Mini Charger for just $19.99 (list price $22) 13% off

      Not for you?
      That's OK, there are other deals on offer you can check out here.

      Ivacy VPN - 5 years at 87% off NordVPN - 2 years at up to 68% off Private Internet Access VPN - subscriptions at up to 79% off Unlocator VPN or SmartDNS - unblock Geoblock with 7-day free trial Subscribe to Neowin - for $14 a year, or $28 a year for Ad-Free experience Giveaways: Apple Giveaway | Gaming Giveaway | Amazon Giveaway Neowin Deals · Free eBooks · Neowin Store

      Disclosure: This is a StackCommerce deal or giveaway in partnership with Neowin; an account at StackCommerce is required to participate in any deals or giveaways. For a full description of StackCommerce's privacy guidelines, go here. Neowin benefits from shared revenue of each sale made through our branded deals site, and it all goes toward the running costs.

    • By WiltshireHam
      Hi, Does anyone know any good resources for converting some Fortran sub-routines to VB?
       
      Cheers,
       
      Pete
    • By Flask
      So this is basically an autoclicker that my friend gave me, it has randomization functions.
      Here are all the functions of the app:

      Click Interval (milliseconds) is the time before the next click.
      add random milliseconds adds a few milliseconds specified by the user to add random intervals every click.
      Add random pixel offset moves your cursor by the specified amount by the user.
      You can also select what the auto clicker uses (Left mouse button, Right, middle button).
      You can also see what your cursor's coordinates are.
       
      The purpose of my request is to add a customizable hotkey for start and stop or at least Just a single customizable hotkey for Toggle on/off; and also can it have a "hide to system tray"?

      This app has an .exe and a WindowsHookLib.dll.

       
      I have this design on my mind. If anyone can do it like this it would be better.

      Sorry if I am asking too much. I'm still new to the scene of VB.
    • By wrack
      Hi,
       
      Being given a task to analyse and collect info on all code paths for a very very large monolithic .NET Web app that is used across various clients.
       
      Thinking about adding in some reflection type code that basically collects data of run-time code path taken depending on the params passed to various methods.
       
      Once I have the data, need to start removing/deprecating code that never gets used in few months in real world. Along with refactoring and adding more test coverage on major code paths to improve quality.
       
      I am aware of unit testing approach but this app is 13+ years old and unit testing can't be just added, can't be easily refactored without breaking something, can't be easily re-written.
       
      Are there any tools frameworks that can be integrated into existing code that would allow me to collect such data?
       
      Not looking for code samples but if anyone has it then awesome. Any help, general guidance, software/framework recommendation would be highly appreciated.
       
      Something like Google Analytics but for the actual source code itself.
       
      TA
    • By Farchord
      So I am working on setting up a new (private) bot for Microsoft Teams that should be able to post messages in a channel on-demand. I already have a bot coded for Google Hangouts Chat, but Microsoft Teams is giving me a really hard time.
      I've been searching for over 10 hours now all over the web, and I am very confused.
       
      Right now, all I want to do is post cards to a Microsoft Teams Channel. So I created the connectorclient, I used the baseuri provided when the bot joined the channel (Starts with smba.trafficmanager.net) with my MSAppID and MSAppPassword. Then, I fill in as much information as I can (Maybe too much?) and I submit the information using the connector's .conversations.createconversation.
       
      Namespaces used: Microsoft.bot.connector, Microsoft.bot.connector.teams.models
       
      Here's the code:
       
      Dim Connector As New ConnectorClient(New Uri("https://smba.trafficmanager.net/amer/"), "MSAPPID", "MSAPPPASSWORD") Dim conversation As New ConversationParameters Dim activity2 = Activity.CreateMessageActivity Dim bot As New ChannelAccount bot.Id = "BOTID" bot.Name = "EDD Bot Test" conversation.Bot = bot Dim chaninfo As New ChannelInfo chaninfo.Id = "CHANID" chaninfo.Name = "General" Dim teaminfo As New TeamInfo teaminfo.Id = "TEAMID" teaminfo.Name = "EDD" activity2.Text = "Test" activity2.ServiceUrl = "https://smba.trafficmanager.net/amer/" activity2.Type = ActivityTypes.Message activity2.From = bot activity2.ChannelId = "msteams" Dim tenantdata As New TenantInfo tenantdata.Id = "TENANTID" Dim teamschanneldata As New TeamsChannelData teamschanneldata.Channel = chaninfo teamschanneldata.Team = teaminfo teamschanneldata.Tenant = tenantdata activity2.ChannelData = teamschanneldata conversation.Activity = activity2 Response.Write(JsonConvert.SerializeObject(conversation)) Try Dim reqresp As ConversationResourceResponse = Connector.Conversations.CreateConversation(conversation) Response.Write("ActivityID: " & reqresp.ActivityId & ", ServiceURL: " & reqresp.ServiceUrl & ", ID: " & reqresp.ServiceUrl) Catch ex As ErrorResponseException Response.Write(ex.Response.Content & " " & ex.Response.ReasonPhrase) End Try This is what the API returns:
       
      {"message":"Authorization has been denied for this request."} Unauthorized
       
      Keep in mind, I'm not even 100% sure I'm using the right method to create the channel message, I figured it was either CreateConversation or ReplyToActivity.
      I gave the app Users.ReadWriteAll permissions too, so am I missing something? That error leads me to think it doesn't have anything to do with the ConversationParameters payload but something to do with authentication.
       
      Thank you.