473,386 Members | 1,726 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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 1458
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
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
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
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
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
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
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
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
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
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
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
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
jinu1996
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...

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.