Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Capturing KeyUp and Setting Value ...

Capturing KeyUp and Setting Value ...

Scheduled Pinned Locked Moved C / C++ / MFC
helpcsharpc++comtools
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mitch F
    wrote on last edited by
    #1

    Hello, I am currently trying to change from VB .Net to VC++ .Net. I am trying to take information from a KeyUp event in the main form (form1), and put the KeyData into label1->Text. Here is my code:

    private: System::Void Form1_KeyUp(System::Object * sender, System::Windows::Forms::KeyEventArgs * e)
    {
    label1->Text = e->KeyData;
    }

    However, it returns me the error saying that "c:\...\TestingC++\Form1.h(96): error C2664: 'System::Windows::Forms::Control::set_Text' : cannot convert parameter 1 from 'System::Windows::Forms::Keys' to 'System::String __gc *'" What should I do to correct this error? Any help will be greatly appreciated, Programmer2k4 My sig: "And it is a professional faux pas to pay someone else to destroy your computer when you are perfectly capable of destroying it yourself." - Roger Wright I now use my CodeProject Blog! Most recent blog post: March 24

    A 1 Reply Last reply
    0
    • M Mitch F

      Hello, I am currently trying to change from VB .Net to VC++ .Net. I am trying to take information from a KeyUp event in the main form (form1), and put the KeyData into label1->Text. Here is my code:

      private: System::Void Form1_KeyUp(System::Object * sender, System::Windows::Forms::KeyEventArgs * e)
      {
      label1->Text = e->KeyData;
      }

      However, it returns me the error saying that "c:\...\TestingC++\Form1.h(96): error C2664: 'System::Windows::Forms::Control::set_Text' : cannot convert parameter 1 from 'System::Windows::Forms::Keys' to 'System::String __gc *'" What should I do to correct this error? Any help will be greatly appreciated, Programmer2k4 My sig: "And it is a professional faux pas to pay someone else to destroy your computer when you are perfectly capable of destroying it yourself." - Roger Wright I now use my CodeProject Blog! Most recent blog post: March 24

      A Offline
      A Offline
      Anthony_Yio
      wrote on last edited by
      #2

      That is because the KeyValue return int. [C++] public: __property int get_KeyValue(); Sonork 100.41263:Anthony_Yio

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups