Click here to Skip to main content
15,911,891 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Adding a label to a group box in runtime... Pin
Christian Graus11-Aug-08 18:40
protectorChristian Graus11-Aug-08 18:40 
QuestionRestricting a multiline text box Pin
JudyV11-Aug-08 11:45
JudyV11-Aug-08 11:45 
AnswerRe: Restricting a multiline text box Pin
Mycroft Holmes11-Aug-08 14:55
professionalMycroft Holmes11-Aug-08 14:55 
GeneralRe: Restricting a multiline text box Pin
JudyV12-Aug-08 5:26
JudyV12-Aug-08 5:26 
GeneralRe: Restricting a multiline text box Pin
JudyV13-Aug-08 5:55
JudyV13-Aug-08 5:55 
GeneralRe: Restricting a multiline text box Pin
JudyV13-Aug-08 7:57
JudyV13-Aug-08 7:57 
GeneralRe: Restricting a multiline text box Pin
Mycroft Holmes13-Aug-08 13:33
professionalMycroft Holmes13-Aug-08 13:33 
GeneralRe: Restricting a multiline text box Pin
JudyV14-Aug-08 4:09
JudyV14-Aug-08 4:09 
Actually it is suppressing the keystroke on the keydown event. I created a derived class and added the count returns as a property and put the keydown event code override in the class and it works well. I also added an event for the text change to keep track of whether or not they go in and delete text and/or a return so that the count will remain accurate while they are working in the text box.

Private Sub MyTextBox_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
If (e.KeyCode = Keys.Enter Or e.KeyCode = Keys.Return) Then
If Me.CRLFCnt > 0 Then
e.SuppressKeyPress = True
Else
Me.CRLFCnt += 1
End If
End If
End Sub

As I said it took me awhile to figure it out and I had a message box popping up to tell them they had tried to put in too many lines and for some reason that caused the suppress method not to work. I tried putting the message box in the keyup event but then it just looped if you hit return on the 'OK' button. If you clicked it with the mouse it went away but we try to code things so the users don't have to take their hands from the keyboard any more than possible.

Thanks for your help it did point me in the right direction and saved me a lot of time.

Judy
GeneralRe: Restricting a multiline text box Pin
Mycroft Holmes14-Aug-08 12:15
professionalMycroft Holmes14-Aug-08 12:15 
QuestionControl of external application via mouse moves and clicks Pin
Andy_ORS11-Aug-08 4:55
Andy_ORS11-Aug-08 4:55 
QuestionVB.net string array problem Pin
Rameez Raja11-Aug-08 1:07
Rameez Raja11-Aug-08 1:07 
AnswerRe: VB.net string array problem Pin
sumit703411-Aug-08 1:22
sumit703411-Aug-08 1:22 
AnswerRe: VB.net string array problem Pin
Manas Bhardwaj11-Aug-08 1:27
professionalManas Bhardwaj11-Aug-08 1:27 
GeneralRe: VB.net string array problem Pin
Rameez Raja11-Aug-08 18:17
Rameez Raja11-Aug-08 18:17 
AnswerRe: VB.net string array problem Pin
Steven St. John12-Aug-08 5:02
Steven St. John12-Aug-08 5:02 
Question[Message Deleted] Pin
kjalandoon11-Aug-08 0:46
kjalandoon11-Aug-08 0:46 
AnswerRe: getting the form value Pin
Christian Graus11-Aug-08 1:54
protectorChristian Graus11-Aug-08 1:54 
GeneralRe: getting the form value Pin
kjalandoon11-Aug-08 16:21
kjalandoon11-Aug-08 16:21 
QuestionString.format problem Pin
Hans vd Bovenkamp10-Aug-08 23:51
Hans vd Bovenkamp10-Aug-08 23:51 
AnswerRe: String.format problem Pin
Christian Graus11-Aug-08 0:21
protectorChristian Graus11-Aug-08 0:21 
GeneralRe: String.format problem Pin
Hans vd Bovenkamp11-Aug-08 1:54
Hans vd Bovenkamp11-Aug-08 1:54 
GeneralRe: String.format problem Pin
Christian Graus11-Aug-08 2:10
protectorChristian Graus11-Aug-08 2:10 
QuestionListView VB.NET... Pin
ROC_Jnr10-Aug-08 21:28
ROC_Jnr10-Aug-08 21:28 
AnswerRe: ListView VB.NET... Pin
Mycroft Holmes10-Aug-08 22:04
professionalMycroft Holmes10-Aug-08 22:04 
GeneralRe: ListView VB.NET... Pin
Thomas Stockwell11-Aug-08 1:33
professionalThomas Stockwell11-Aug-08 1:33 

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.