473,503 Members | 1,727 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Trouble understanding changesl from vb6 to .net ... how do you...

Hello:

What replaces "locking" a text or "combo" box so that input is not allowed?
Do not want to use disable.

How can you trap all keyboard input and set it equal to nothing?

Thanks

Terry
Nov 20 '05 #1
3 1462
Terry,
What replaces "locking" a text or "combo" box so that input is not allowed? Do not want to use disable
Try the .ReadOnly property.
How can you trap all keyboard input and set it equal to nothing?


Not quite sure I understand what you're trying to do here. If developing a
windows form you can capture the keypress event. Something like the
following:

Private Sub frmMyForm_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
AddHandler somecontrol.KeyPress, AddressOf CheckMyKeyPress
End Sub

Private Sub CheckMyKeyPress(ByVal sender As System.Object, _
ByVal e As System.Windows.Forms.KeyPressEventArgs)

Select Case Asc(e.KeyChar)
Case AscW(ControlChars.Cr) 'Enter key
txtStatus.Text = "You Pressed The Enter Key"
Case Else ' Everything else
Exit Sub
End Select
End Sub

HTH,

Raymond Lewallen
Nov 20 '05 #2
Terry,
What replaces "locking" a text or "combo" box so that input is not allowed? Do not want to use disable
Try the .ReadOnly property.
How can you trap all keyboard input and set it equal to nothing?


Not quite sure I understand what you're trying to do here. If developing a
windows form you can capture the keypress event. Something like the
following:

Private Sub frmMyForm_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
AddHandler somecontrol.KeyPress, AddressOf CheckMyKeyPress
End Sub

Private Sub CheckMyKeyPress(ByVal sender As System.Object, _
ByVal e As System.Windows.Forms.KeyPressEventArgs)

Select Case Asc(e.KeyChar)
Case AscW(ControlChars.Cr) 'Enter key
txtStatus.Text = "You Pressed The Enter Key"
Case Else ' Everything else
Exit Sub
End Select
End Sub

HTH,

Raymond Lewallen
Nov 20 '05 #3
In the event for keypress, you can set e.Handled = True, and the keypress will be ignored. If you want this to apply to the whole form (which would prevent any keyed input) you could set the key preview for the form to true and use something like the following

frm_Keypress(ByVal e as KeyPressEventArgs) Handles ..etc.
e.Handled = Tru

Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
3012
by: Weston C | last post by:
I'm having some trouble with Mail_Mime... it looks as if it isn't handling the creation of headers transparently. Here's what I'm essentially doing: $MimeMesg = new Mail_mime();...
2
2572
by: Freddie | last post by:
Hi, I've been mangling python-irclib into an asyncore class, so it fits in nicely with the rest of my app. I ran into a problem with asyncore.dispatcher_with_send (Python 2.3.4), though. Not...
7
1497
by: CheGueVerra | last post by:
First of all Hello all you css freak. geeks and gurus. I just started using css for some web pages I had to do at work and I'im testing some stuff at home to understand more. Now, I wanted to...
1
2118
by: don | last post by:
I'm trying to import a comma delimited text file into MS Access 2002 version - the first column is set for an auto increment primary key and everything works right the first time I import a text...
5
2496
by: Krumble Bunk | last post by:
Hello! First things first (but not necessarily in that order), this is a really great group, and has helped me understand more and more C everytime I read the postings, so thanks for a great...
6
1892
by: Hypo | last post by:
Im relatilvly new to a web programming in general, and here's the situation i have: I have a default page with dynamic content, and one button with onclick code something like this: { // do...
9
2364
by: Greg Linwood | last post by:
I'm having difficulty understanding Session state in ASP.Net. It's almost embarrassing asking this as I've been using ASP since it was first released & it really shouldn't be this hard to use -...
6
3764
by: Daniel Walzenbach | last post by:
Hi, I have a web application which sometimes throws an “out of memory” exception. To get an idea what happens I traced some values using performance monitor and got the following values (for...
2
1546
by: rubikzube* | last post by:
I'm new to mysql and I was wondering if I could trouble some of you for help. I have a table in my database that may contain multiple versions of the same element as different rows. I wanted to...
1
1211
by: sndive | last post by:
i have a lot of trouble selling twisted a a client lib for network access (on embedded platform) the group i'm a member of wants to write some unmaintainable threaded blocking junk in c--. does...
0
7203
marktang
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,...
0
7087
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...
0
7281
Oralloy
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,...
1
6993
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...
1
5014
isladogs
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...
0
4675
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...
0
3168
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...
0
3156
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1514
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.