I have created a users control with a text box and button on it, what I want
to do is override the usercontrol Keydown events with that of the Text box.
What is the correct syntax to accomplish this?
Example of my text box sub:-
Private Sub Edit_KeyDown(By Val sender As Object, ByVal e As
System.Windows. Forms.KeyEventA rgs) Handles Edit.KeyDown
End Sub
Thanks 16 3240
Hello,
"Merlin" <je**@jg-tech.co.uk> schrieb: I have created a users control with a text box and button on it, what I want to do is override the usercontrol Keydown events with that of the Text box. What is the correct syntax to accomplish this?
What behavior would you expect?
Regards,
Herfried K. Wagner
--
MVP · VB Classic, VB .NET http://www.mvps.org/dotnet
"Merlin" <je**@jg-tech.co.uk> schrieb I have created a users control with a text box and button on it, what I want to do is override the usercontrol Keydown events with that of the Text box.
???
Sorry, I don't get your intention.
What is the correct syntax to accomplish this?
Example of my text box sub:- Private Sub Edit_KeyDown(By Val sender As Object, ByVal e As System.Windows. Forms.KeyEventA rgs) Handles Edit.KeyDown End Sub
--
Armin
Sorry, I'll try to make myself clearer:-
What I want to be able to do is place my UserControl on a form and then in
the UserControl KeyDown Event trap key presses from my text box that is
within the UserControl. So in otherwords override the UserControl KeyDown
Events with the Text box KeyDown Events.
Thanks,
Merlin
"Merlin" <je**@jg-tech.co.uk> wrote in message
news:bi******** **@hercules.bti nternet.com... I have created a users control with a text box and button on it, what I
want to do is override the usercontrol Keydown events with that of the Text
box. What is the correct syntax to accomplish this?
Example of my text box sub:- Private Sub Edit_KeyDown(By Val sender As Object, ByVal e As System.Windows. Forms.KeyEventA rgs) Handles Edit.KeyDown End Sub
Thanks
"Merlin" <je**@jg-tech.co.uk> schrieb Sorry, I'll try to make myself clearer:-
What I want to be able to do is place my UserControl on a form and then in the UserControl KeyDown Event trap key presses from my text box that is within the UserControl. So in otherwords override the UserControl KeyDown Events with the Text box KeyDown Events.
Now I think I understand - if you leave out the last sentence. ;-)
You can handle the textbox' keypress event in the Usercontrol:
Private Sub TextBox1_KeyPre ss( _
ByVal sender As Object, _
ByVal e As System.Windows. Forms.KeyPressE ventArgs) _
Handles TextBox1.KeyPre ss
End Sub
Still I don't think that's what you wanted to know, so...
--
Armin
Hello,
"Armin Zingler" <az*******@free net.de> schrieb: Sorry, I'll try to make myself clearer:-
What I want to be able to do is place my UserControl on a form and then in the UserControl KeyDown Event trap key presses from my text box that is within the UserControl. So in otherwords override the UserControl KeyDown Events with the Text box KeyDown Events.
Now I think I understand - if you leave out the last sentence. ;-)
You can handle the textbox' keypress event in the Usercontrol:
Private Sub TextBox1_KeyPre ss( _ ByVal sender As Object, _ ByVal e As System.Windows. Forms.KeyPressE ventArgs) _ Handles TextBox1.KeyPre ss
End Sub
Still I don't think that's what you wanted to know, so...
I think merlin wants to forward/redirect the keyboard input of the textbox
to the usercontrol. Every time the user presses a key in the textbox, the
usercontrol's KeyPress event should be raised.
Regards,
Herfried K. Wagner
--
MVP · VB Classic, VB .NET http://www.mvps.org/dotnet
Hi Merlin,
If the other responses haven't quite answered your question (I
find it quite ambiguous), can you tell us <why> you want this override
and what you hope to achieve?
Regards,
Fergus
Sorry, I'll try to make myself clearer:-
What I want to be able to do is place my UserControl on a form and then in
the UserControl KeyDown Event trap key presses from my text box that is
within the UserControl. So in otherwords override the UserControl KeyDown
Events with the Text box KeyDown Events.
Thanks,
Merlin
Hello,
"Merlin" <je**@jg-tech.co.uk> schrieb: What I want to be able to do is place my UserControl on a form and then in the UserControl KeyDown Event trap key presses from my text box that is within the UserControl. So in otherwords override the UserControl KeyDown Events with the Text box KeyDown Events.
Untested (!), code for the UserControl:
\\\
Private Sub TextBox1_KeyDow n( _
ByVal sender As Object, _
ByVal e As System.Windows. Forms.KeyEventA rgs _
) Handles TextBox1.KeyDow n
MyBase.OnKeyDow n(e)
End Sub
///
HTH,
Herfried K. Wagner
--
MVP · VB Classic, VB .NET http://www.mvps.org/dotnet
Ok here goes,
I have created a control that has a text box and a button at the end of the
text box, I want my control to totally emulate a text box, but have the
added addition of a button at the end. The idea of this control is to allow
a user to input text in the normal manner or press a button to display a
pick list.
Therefore I want the usercontrol events all overridden with the Text box
events. As it stands If I were to place my user control on a form and trap
the usercontrol keydown event when entering text, I'd only be trapping
events for the user control so get nothing whereas I want to trap the text
box events:-
i.e
instead of UserControl.Tex tBox1.Keydown
I want UserControl.Key down to be exactly the same.
Hope thats clearer.
Thanks
Merlin.
"Fergus Cooney" <fi******@tesco .net> wrote in message
news:uY******** ******@TK2MSFTN GP09.phx.gbl... Hi Merlin,
Lol. That's the <what>. Can you tell us the <why> ?
This is the bit that everyone is struggling to understand. It really
makes <no sense> to us at all, yet it's the bit that you haven't changed!!
Post 1: override the usercontrol Keydown events with that of the Text box Post 2: override the UserControl KeyDown Events with the Text box KeyDown Events Post 3: override the UserControl KeyDown Events with the Text box KeyDown Events
Tell us in human terms. - What effect do you want to achieve - for yourself, for the user?
With curiousity and anticipation, Fergus.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: ECVerify.com |
last post by:
I posted this earlier but never got a response...so I am trying again
****************************
Hey everyone,
I have a simple (I hope question)
To get the events in C# I can go to the designer view and I can select
an event for any control or form via the lightning bolt...cool
|
by: Christopher W. Douglas |
last post by:
I am developing a VB.NET app using Visual Studio.NET 2003. VB.NET allows
me to create a class with two or more methods that have the same name, as
long as they have different (non-optional) arguments, such as:
FirstClass
Public Sub Populate(string)
Public Sub Populate(string, string)
I don't have to use Overloads, because both methods...
|
by: ECVerify.com |
last post by:
This should be a basic question.
In VB.NET in the two drop downs over the source code for a form you
can get a list of the events and overrides for that form. In VC++ in
the properties window you can get the events and overrides. But for
some reason I can not seem to find the list of events and overrides
for a C# form, if I do this. the...
|
by: Edward Diener |
last post by:
In C++ an overridden virtual function in a derived class must have the exact
same signature of the function which is overridden in the base class, except
for the return type which may return a pointer or reference to a derived
type of the base class's return type.
In .NET the overridden virtual function is similar, but an actual parameter...
|
by: Surrealist |
last post by:
I need something likes as when I create an event procedure.
I can use top-left and top-right dropdown list of code editor
to select object and its exposed events respectively.
Then, the IDE, automatically paste the function
header (signature) for me.
But I can't find a way to see list of Sub or Function
that I can overrides such as...
| |
by: Dot net work |
last post by:
Hello,
My simple code is here:
Public Class MyDictionary
Inherits System.Collections.DictionaryBase
Private Class MyElement
Public Overloads Overrides Function Equals(ByVal obj As Object) As Boolean
End Function
|
by: ljlevend |
last post by:
I've noticed in VS.NET v2.0 Beta 1 that the (Overrides) item does not appear
in the ComboBox that lists all of the classes in the current file (and also
contains the General item and the ( Events) items). Does anybody
know if the (Overrides) item is planned to be returned in the final version
of VS.NET v2.0? I find it to be extremely useful....
|
by: Kalvin |
last post by:
I found some code in Google, don't remember where, for an AutoComplete
combobox. Everything is great with it except for one thing. If I use
the mouse to drop the list down, then start typing to find the item in
the list, the visible text changes, but the values of me.Text and
Mybase.Text do not change. If you use the mouse and actually...
|
by: Ron Dahl |
last post by:
I'm very confused on how the Protected Overrides works.
I created a new project with a new form1 and a new datagrid called
myDataGrid.
I created a simple DataTable and put 5 rows and 5 columns of data into it.
I bound the DataTable to the DataGrid.
The example at the end of this post is exactly as copied from the vb.net
help screen:
I...
|
by: Eric |
last post by:
Can someone please tell me how to rectify this. The full error is:
sub 'Dispose' cannot be declared 'Overrides' because it does not override a
sub in a base class.
Followed by:
'Dispose' is not a member of 'System.Object'.
Here's the method:
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |