Encountered some problems when creating myTextBox by inheriting TextBox

This forum is meant for questions about the Visual FoxPro Language support in X#.

Post Reply
User avatar
xinjie
Posts: 108
Joined: Wed May 20, 2020 10:05 am
Location: China
Contact:

Encountered some problems when creating myTextBox by inheriting TextBox

Post by xinjie »

Hi,

I want to create a myTextBox because a TextBox cannot shift the mouse focus by typing Enter.
I wrote down the following code after going through some C# related material:

Code: Select all

Using System
Using System.Collections.Generic
Using System.ComponentModel
Using System.Linq
Using System.Text

Using System.Drawing
Using System.Windows.Forms

Begin Namespace myBaseClass
    /// <summary>
    /// The myTextBox class.
    /// </summary>
    Define Class myTextBox As TextBox
        Procedure OnKeyDown(KeyEventArgs e)
        Endproc
    Enddefine
End Namespace
I'm getting two errors when I build a class library project as a DLL that contains only this one class:
XS1003 Syntax error, 'END NAMESPACE' expected
XS9002 Parser: unexpected input 'e'

I need help.
简单的东西重复做,你能成为专家;重复的东西用心做,你能成为赢家!
User avatar
wriedmann
Posts: 3783
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Re: Encountered some problems when creating myTextBox by inheriting TextBox

Post by wriedmann »

Hi Xinjie,
the C# code

Code: Select all

Procedure OnKeyDown(KeyEventArgs e)
in X# has to be written as

Code: Select all

Procedure OnKeyDown(e as KeyEventArgs)
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
xinjie
Posts: 108
Joined: Wed May 20, 2020 10:05 am
Location: China
Contact:

Re: Encountered some problems when creating myTextBox by inheriting TextBox

Post by xinjie »

Hi, Wolfgang
Thank you!
简单的东西重复做,你能成为专家;重复的东西用心做,你能成为赢家!
Post Reply