🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.csharpbuilder.language.csharp
Article #161

send keys

#161
From: Shane
Date: Thu, 31 Aug 2006 04:48
35 lines
2286 bytes
Hi all :-)
I have created a simple form with buttons, the form does as I wish, clicking
on the buttons with the mouse produces the desired result.  I have decided
that to make it really clever I should tie key presses to the form
(somehow) so that if I press a '2' key ,then I'd like a button to act as
though it has been clicked, and the normal course of events should flow
from there.

Ive had a look on google, I got the following link, which *sounds* to me
what I want, but I dont know how to implement it into my form.
http://msdn2.microsoft.com/en-us/library/system.windows.forms.sendkeys.send.aspx
What I tried was copying and pasting what I thought was the constructor into
my code

public static void Send (
    string keys
)

and then pasted the following line into my private button2_click() event
SendKeys.Send("2");

But I got an error about Send not being a function (etc)
So Im guessing Ive not done something right

Any help appreciated

TIA


-- 
 "I'm never gonna get used to the thirty-first century. Caffeinated bacon?
Baconated grapefruit? Admiral Crunch?" -Fry 
 "Well if you don't like that, try some Archduke Chocula." -Leela 

blog: http://shanes.dyndns.org
Technical Details
Message-ID: <ed5pkn$gue$1@lust.ihug.co.nz>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news.glorb.com!newsfeeds.ihug.co.nz!lust.ihug.co.nz!ihug.co.nz!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 1efe35,b46302f5c1eb4fb3,start
X-Google-Attributes: gid1efe35,public
X-Google-Language: ENGLISH,ASCII-7-bit
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news.glorb.com!newsfeeds.ihug.co.nz!lust.ihug.co.nz!ihug.co.nz!not-for-mail
From: Shane <shane@weasel.is-a-geek.net>
Newsgroups: borland.public.csharpbuilder.language.csharp
Subject: send keys
Date: Thu, 31 Aug 2006 16:48:07 +1200
Organization: Ihug Ltd
Lines: 36
Message-ID: <ed5pkn$gue$1@lust.ihug.co.nz>
NNTP-Posting-Host: 203-109-245-158.static.bliink.ihug.co.nz
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7Bit
X-Trace: lust.ihug.co.nz 1156999639 17358 203.109.245.158 (31 Aug 2006 04:47:19 GMT)
X-Complaints-To: abuse@ihug.co.nz
NNTP-Posting-Date: Thu, 31 Aug 2006 04:47:19 +0000 (UTC)
User-Agent: KNode/0.10.2
X-face: G70/#QiKd/@iwS%>'/6G_^76)e(>7%xp+=Aje?D[0I\Pl]F~!eGdl83<GbX$E67syR/d>u* /_0EI)d|9;[-`RZiNt-E09{{e'GX&:?OOMLR`dwW8U?Vw]??Zvjgx4$k{glX~${)(HnE="sw.qYg~,@)Bi1uHr*YYaIr9ja?~+dDme4YF]zY5yI0;d~5Dz8F"B$,ot:7Mf!-KwmHaA