Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > .NET Languages
You last visited: Today at 08:43

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[C#]KeyEvent Problem

Discussion on [C#]KeyEvent Problem within the .NET Languages forum part of the Coders Den category.

Reply
 
Old   #1
 
Naworia's Avatar
 
elite*gold: 12
Join Date: Aug 2011
Posts: 455
Received Thanks: 418
[C#]KeyEvent Problem

What is wrong about this script?
Code:
private void Form1_KeyDown(object sender, KeyEventArgs e)
        { 
            if (e.KeyData == Keys.F6)
            {
                MessageBox.Show("Succesful");
            }
        }
There is no error but when i pressed F6, happens nothing...
Note : Form KeyPreview = true
Naworia is offline  
Old 07/02/2012, 21:13   #2
 
elite*gold: 7
Join Date: Jun 2012
Posts: 168
Received Thanks: 95
IDK I work with vb.net 10
But google is your friend ;
ЙôČhěάŧĪмPĞM-hacked is offline  
Old 07/02/2012, 21:21   #3
 
Naworia's Avatar
 
elite*gold: 12
Join Date: Aug 2011
Posts: 455
Received Thanks: 418
I searched much time but i can't find my answer...
Naworia is offline  
Old 07/02/2012, 21:29   #4
 
elite*gold: 7
Join Date: Jun 2012
Posts: 168
Received Thanks: 95
You can change this program in c# in vb.net ?
Maybe I can help you
ЙôČhěάŧĪмPĞM-hacked is offline  
Old 07/02/2012, 22:38   #5
 
Naworia's Avatar
 
elite*gold: 12
Join Date: Aug 2011
Posts: 455
Received Thanks: 418
sry i must do it for c#
Naworia is offline  
Old 07/03/2012, 12:31   #6
 
Kraizy​'s Avatar
 
elite*gold: 0
The Black Market: 471/0/0
Join Date: Apr 2010
Posts: 9,696
Received Thanks: 1,810
PHP Code:
public Form1()
{
     
InitializeComponent();
     
this.KeyDown += new KeyEventHandler(OnKeyDown)
}

private 
void OnKeyDown(object senderKeyEventArgs e)
{
     if (
e.KeyData == Keys.F6)
     {
          
MessageBox.Show("abc");
     }

Kraizy​ is offline  
Thanks
1 User
Old 07/04/2012, 01:32   #7
 
elite*gold: 7
Join Date: Jun 2012
Posts: 168
Received Thanks: 95
Sorry but very small correction

Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {}
            public Form1() 
{ 
     InitializeComponent(); 
     this.KeyDown += new KeyEventHandler(OnKeyDown);
} 

private void OnKeyDown(object sender, KeyEventArgs e) 
{ 
     if (e.KeyData == Keys.F6) 
     { 
          MessageBox.Show("abc"); 
     } 
} 
        }
    }
ЙôČhěάŧĪмPĞM-hacked is offline  
Old 07/04/2012, 14:30   #8
 
elite*gold: 42
Join Date: Jun 2008
Posts: 5,426
Received Thanks: 1,888
Quote:
Originally Posted by ЙôČhěάŧĪмPĞM-hacked View Post
Sorry but very small correction

Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {}
            public Form1() 
{ 
     InitializeComponent(); 
     this.KeyDown += new KeyEventHandler(OnKeyDown);
} 

private void OnKeyDown(object sender, KeyEventArgs e) 
{ 
     if (e.KeyData == Keys.F6) 
     { 
          MessageBox.Show("abc"); 
     } 
} 
        }
    }
Great correction! 2 Constructors with the same name and an unused event, you must be an awesome coder! Not to mention you ****** up the formatting.
MoepMeep is offline  
Old 07/04/2012, 14:49   #9

 
boxxiebabee's Avatar
 
elite*gold: 0
Join Date: May 2008
Posts: 1,222
Received Thanks: 500
Die Formatierung in Visual Studio zu versauen ist schon ne Kunst... ^^
boxxiebabee is offline  
Thanks
1 User
Reply


Similar Threads Similar Threads
[Problem]Habe ein Problem und zwar spinnt mein VPC etwas(ohne Grund)?!
07/28/2011 - Metin2 Private Server - 10 Replies
Also wie schon gesagt meins Server spinnt wodurch kiks usw. kommen :( ich lade euch die Screens in den Anhang, mit der Hoffnung, dass ihr mir helfen könnt :) wäre echt sehr nice :)



All times are GMT +2. The time now is 08:43.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.