What reference should I add for the namespace 'Keys'?

zenfreak

Client
Регистрация
21.08.2013
Сообщения
249
Благодарностей
12
Баллы
18
I am trying to use:

Код:
string result = Emulator.SendKey(instance.ActiveTab.Handle,System.Windows.Forms.Keys.Enter, KeyboardEvent.Down);
and I'm getting this error:


The type or namespace name 'Keys' does not exist in the namespace 'System.Windows.Forms' (are you missing an assembly reference?)

What reference should I add to get this working?

This happens in codecreator but I'm pretty sure it's the same in projectmaker
 

VladZen

Administrator
Команда форума
Регистрация
05.11.2014
Сообщения
22 453
Благодарностей
5 913
Баллы
113
Maybe you have old version of this assembly...
Do you have thsi in C# block?
System_forms_keys.png
 

EtaLasquera

Client
Регистрация
02.01.2017
Сообщения
526
Благодарностей
112
Баллы
43
Try start new project and search for namespace keys... I already got that problem in a project...
 

LaGir

Client
Регистрация
01.10.2015
Сообщения
227
Благодарностей
927
Баллы
93

zenfreak

Client
Регистрация
21.08.2013
Сообщения
249
Благодарностей
12
Баллы
18
@VladZen In ProjectMaker I just checked it and I have it just like in your picture but I am using CodeCreator and I don't see the .Forms.Keys here:


@SOS Cartões Not sure what you mean ... where should I search for the namespace keys?
@LaGir If this is what you mean, then I have it because I have manually added it after previously getting an error about the namespace name windows.Forms



PS: I'm using the latest version 5.11.5.0
 

LaGir

Client
Регистрация
01.10.2015
Сообщения
227
Благодарностей
927
Баллы
93
If this is what you mean, then I have it because I have manually added it after previously getting an error about the namespace name windows.Forms
WindowsFormsIntegration.dll contains 'System.Windows.Forms.Integration' namespace, but not contains 'System.Windows.Forms' namespace. So, this dll doesn't contain 'Keys' enum.
So you need to add a reference to System.Windows.Forms.dll.
2017-08-10_14-00-27.png
 
  • Спасибо
Реакции: zenfreak и VladZen

zenfreak

Client
Регистрация
21.08.2013
Сообщения
249
Благодарностей
12
Баллы
18
@LaGir Thanks again for taking the time to read my mind and understand what I'm having trouble with. My mistake was that I wasn't searching for the system.windows.forms in the references search bar as the error clearly stated.
 

Кто просматривает тему: (Всего: 2, Пользователи: 0, Гости: 2)