Hi,
In multiLine textBox, enter moves to the next line, how can i overwrite it,
so enter will move to the next control and ctrl + enter will move to the next
line?
Thanks,
Gidi. 4 3815
Heya Gidi,
You need to override the ProcessCmdKeys method of your form to access and
tweak the keys and what they do in your system.
<code>
protected override bool ProcessCmdKey(r ef System.Windows. Forms.Message msg,
System.Windows. Forms.Keys keyData)
{
if (keyData == Keys.Enter)
{
//Your method to handle the enter
return true;
//This needs to return true or your application
//Won't "see" the enter being handled in the ProcessCmdKeys
}
return base.ProcessCmd Key(msg, keyData);
}
</code>
HTH
Brendon
"Gidi" <sh*****@hotmai l.com.dontspamw rote in message
news:35******** *************** ***********@mic rosoft.com...
Hi,
In multiLine textBox, enter moves to the next line, how can i overwrite
it,
so enter will move to the next control and ctrl + enter will move to the
next
line?
Thanks,
Gidi.
Hi Gidi,
I do not know why you want this functionality. Actually, Enter shold
take to the next line and tab will take you to next control. (As per
the standards).
However if you insists on the functionality, please write or enable
keydown event for the textbox and ovverride the functionality of
same.
Thanks
-Cnu.
On Oct 29, 1:13 pm, Gidi <shna...@hotmai l.com.dontspamw rote:
Hi,
In multiLine textBox, enter moves to the next line, how can i overwrite it,
so enter will move to the next control and ctrl + enter will move to the next
line?
Thanks,
Gidi.
Hi Brendon,
Thanks,
I've 2 more questions\probl ems:
1. As i understand i should create a user-control that inherits from TextBox
and then override the event (I can't just overRide it in my windows form),
right?
2. now, if i want to move to the next line, i tried to do:
textbox1.Text = textBox1.Text + Environment.New Line;
the thing is that the crouser always gets back to the right upper corner of
the TextBox (instead of staying in the newline position).
Thanks,
Gidi
"Brendon Bezuidenhout" wrote:
Heya Gidi,
You need to override the ProcessCmdKeys method of your form to access and
tweak the keys and what they do in your system.
<code>
protected override bool ProcessCmdKey(r ef System.Windows. Forms.Message msg,
System.Windows. Forms.Keys keyData)
{
if (keyData == Keys.Enter)
{
//Your method to handle the enter
return true;
//This needs to return true or your application
//Won't "see" the enter being handled in the ProcessCmdKeys
}
return base.ProcessCmd Key(msg, keyData);
}
</code>
HTH
Brendon
"Gidi" <sh*****@hotmai l.com.dontspamw rote in message
news:35******** *************** ***********@mic rosoft.com...
Hi,
In multiLine textBox, enter moves to the next line, how can i overwrite
it,
so enter will move to the next control and ctrl + enter will move to the
next
line?
Thanks,
Gidi.
Gidi,
If I understand your questions right - With #1 You would not need to create
a custom textbox to override ProcessCmdKeys - That can be done in your form
OR it can be done in a custom textbox it depends on your application. If you
know that your form is not going to handle any weird keys like this then
create a custom control to handle it - Just make sure you check that the
textbox on your UserControl has focus - Just as a fail safe incase you do
use ProcessCmd on your form.
<code>
protected override bool ProcessCmdKey(r ef System.Windows. Forms.Message msg,
System.Windows. Forms.Keys keyData)
{
if (this.textBox1. Focused)
{
if (keyData == Keys.Enter)
{
//Your method to handle the enter
return true;
//This needs to return true or your application
//Won't "see" the enter being handled in the
ProcessCmdKeys
}
else if (keydata == (Keys.Enter + Keys.Shift))
{
//Your method to handle Shift + Enter
return true;
}
}
return base.ProcessCmd Key(msg, keyData);
}
</code>
As for setting the new line in the textbox - I'm not sure EXACTLY off hand
how to go about that - but I'm sure you can set the selected text in a text
box - so get the last index of the text box and set it as selected :)
HTH
Brendon
"Gidi" <sh*****@hotmai l.com.dontspamw rote in message
news:FB******** *************** ***********@mic rosoft.com...
Hi Brendon,
Thanks,
I've 2 more questions\probl ems:
1. As i understand i should create a user-control that inherits from
TextBox
and then override the event (I can't just overRide it in my windows form),
right?
2. now, if i want to move to the next line, i tried to do:
textbox1.Text = textBox1.Text + Environment.New Line;
the thing is that the crouser always gets back to the right upper corner
of
the TextBox (instead of staying in the newline position).
Thanks,
Gidi
"Brendon Bezuidenhout" wrote:
>Heya Gidi,
You need to override the ProcessCmdKeys method of your form to access and tweak the keys and what they do in your system.
<code> protected override bool ProcessCmdKey(r ef System.Windows. Forms.Message msg, System.Windows .Forms.Keys keyData) { if (keyData == Keys.Enter) { //Your method to handle the enter return true; //This needs to return true or your application //Won't "see" the enter being handled in the ProcessCmdKeys } return base.ProcessCmd Key(msg, keyData); } </code>
HTH Brendon
"Gidi" <sh*****@hotmai l.com.dontspamw rote in message news:35******* *************** ************@mi crosoft.com...
Hi,
In multiLine textBox, enter moves to the next line, how can i overwrite
it,
so enter will move to the next control and ctrl + enter will move to
the
next
line?
Thanks,
Gidi.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Suresh Kumaran |
last post by:
Hi All,
Does anybody know the sytax in VB.NET to write the
contents of a multiline text box to a text file?
Appreciate help.
Suresh
|
by: Joel Finkel |
last post by:
Folks,
I have a form that has several TextBoxes, some of which have the TextMode set to MultiLine. Each is pre-loaded with data from a database. The user is allowed to modify each entry.
The problem is that only the modified data from the SingleLine TextBoxes are returned. The original data are returned for the MultiLine TextBoxes. Also, if the page is sent to the server (for validation, for instance), only the modified data for the...
|
by: RTM |
last post by:
Can anyone help me with the following issue? I've seen some similar
questions here, but none relating to a textbox control....
I have a form with several controls, one of them being a textbox
control with AutoPostBack set to true. I need to fire a method ONLY
when the form has posted back due to a button click (no problem here),
or from the user typing text in the text box and hitting enter. I
can't call this method from any postback,...
|
by: Enzo Marinelli |
last post by:
Hello everyone
I have a MultiLine TextBox, as follows
<asp:TextBo
Id="StreetAddress
Rows="4
Runat="Server
TextMode="MultiLine
Width="100%"/
|
by: sverre.bakke |
last post by:
Hi
I am using a multiline textbox with wordwrapping for creating "large"
texts, but I dont want the user to be able to create a new line. The
property called SuppressKeyPress seem to be the perfect way to solve
this using the KeyDown event. It doesnt work.
My code looks like this:
if (e.KeyCode == Keys.Enter)
| |
by: Mike |
last post by:
I am trying to write a little program for my own use using VB2005 express edition.
I have a list of peoples names in a file that I read into an array of strings. I am using a multiline textbox
to enter new, edit existing, and view the names in the array. This all works well, but now I want to be able
to select one more names from the list displayed in the multiline textbox then click a button to copy the
selected names into another list so...
|
by: Anil Gupte |
last post by:
I have read a lot about getting lines from a multiline textbox in VB.Net.
However, I cannot for the life of me figure out how to write to a multiline
textbox. Basically, I have created an array of strings which I want to
"paste" into a multiline textbox. Any ideas?
--
Anil Gupte
www.keeninc.net
www.icinema.com
|
by: Nathan Sokalski |
last post by:
I have a multiline TextBox that I want to display the text used to create a
control in an apsx file. I want each of these to be on a separate line in
the TextBox. The only way I know of to place things on separate lines in a
TextBox without doing it programmatically is the following:
<asp:TextBox ID="txtMultiLine" runat="server" TextMode="MultiLine">
Line 1
Line 2
Line 3
</asp:TextBox>
|
by: Jason Huang |
last post by:
Hi,
How do I override a TextBox's KeyPress evnt? And how do we use it?
Thanks for help.
Jason
|
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 usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |