Click here to Skip to main content
15,908,274 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: adding new record and saving in VB.NET Pin
7prince19-Feb-07 8:46
7prince19-Feb-07 8:46 
AnswerRe: adding new record and saving in VB.NET Pin
Christian Graus19-Feb-07 10:17
protectorChristian Graus19-Feb-07 10:17 
QuestionRetain values in drop down lists between redirects Pin
dasumohan19-Feb-07 5:20
dasumohan19-Feb-07 5:20 
AnswerRe: Retain values in drop down lists between redirects Pin
Marcus J. Smith19-Feb-07 6:55
professionalMarcus J. Smith19-Feb-07 6:55 
QuestionVb.net text box that accepts Caps A-Z Pin
kendo1719-Feb-07 5:09
kendo1719-Feb-07 5:09 
AnswerRe: Vb.net text box that accepts Caps A-Z Pin
Thomas Stockwell19-Feb-07 6:50
professionalThomas Stockwell19-Feb-07 6:50 
AnswerRe: Vb.net text box that accepts Caps A-Z Pin
Marcus J. Smith19-Feb-07 6:53
professionalMarcus J. Smith19-Feb-07 6:53 
AnswerRe: Vb.net text box that accepts Caps A-Z Pin
TwoFaced19-Feb-07 8:49
TwoFaced19-Feb-07 8:49 
Why annoy the user if it's a lowercase letter, just convert it to uppercase for them. The following code will only allow letters and it converts them to uppercase. It also allows backspace, delete etc. If you want to message the user for invalid keys you could add a message here as well. Also as suggested before you may want to create your own control and inherit the textbox class, which will allow you to create a reusable control that has this validation built in. You could also simply add handlers so this routine handles all the textboxes you want validated. One other note, users will still be able paste invalid text into the textbox. You should validate this text in the validate event, or prevent users for pasting by setting the property 'ShortcutsEnabled' to false.
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
    'If key press isn't control key (backspace...and others?) or a letter then ignore it
    If Not (Char.IsControl(e.KeyChar) OrElse Char.IsLetter(e.KeyChar)) Then e.Handled = True
    'Force capitalized letter
    If Char.IsLetter(e.KeyChar) Then e.KeyChar = Char.ToUpper(e.KeyChar)
End Sub

GeneralRe: Vb.net text box that accepts Caps A-Z Pin
kendo1719-Feb-07 11:00
kendo1719-Feb-07 11:00 
GeneralRe: Vb.net text box that accepts Caps A-Z Pin
TwoFaced19-Feb-07 11:12
TwoFaced19-Feb-07 11:12 
GeneralRe: Vb.net text box that accepts Caps A-Z Pin
kendo1719-Feb-07 23:10
kendo1719-Feb-07 23:10 
GeneralRe: Vb.net text box that accepts Caps A-Z Pin
TwoFaced20-Feb-07 7:23
TwoFaced20-Feb-07 7:23 
GeneralRe: Vb.net text box that accepts Caps A-Z Pin
kendo1719-Feb-07 11:34
kendo1719-Feb-07 11:34 
GeneralRe: Vb.net text box that accepts Caps A-Z Pin
TwoFaced19-Feb-07 13:09
TwoFaced19-Feb-07 13:09 
Questiontwo queries in sqldataadapter Pin
amaneet19-Feb-07 3:59
amaneet19-Feb-07 3:59 
AnswerRe: two queries in sqldataadapter Pin
Colin Angus Mackay19-Feb-07 4:12
Colin Angus Mackay19-Feb-07 4:12 
Questionstrong type and dll help Pin
amaneet19-Feb-07 3:57
amaneet19-Feb-07 3:57 
AnswerRe: strong type and dll help Pin
Colin Angus Mackay19-Feb-07 4:09
Colin Angus Mackay19-Feb-07 4:09 
Questionbackward compatibility Pin
amaneet19-Feb-07 3:53
amaneet19-Feb-07 3:53 
AnswerRe: backward compatibility Pin
Colin Angus Mackay19-Feb-07 4:06
Colin Angus Mackay19-Feb-07 4:06 
QuestionQuery problem Pin
amaneet19-Feb-07 3:50
amaneet19-Feb-07 3:50 
AnswerRe: Query problem Pin
Colin Angus Mackay19-Feb-07 4:05
Colin Angus Mackay19-Feb-07 4:05 
AnswerRe: Query problem Pin
andyharman19-Feb-07 7:15
professionalandyharman19-Feb-07 7:15 
QuestionNamespaces problem Pin
amaneet19-Feb-07 3:45
amaneet19-Feb-07 3:45 
AnswerRe: Namespaces problem Pin
Colin Angus Mackay19-Feb-07 4:04
Colin Angus Mackay19-Feb-07 4:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.