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

Visual Basic

 
QuestionThanks Dave Kreskowiak Pin
Adekolurejo8-Mar-07 21:15
Adekolurejo8-Mar-07 21:15 
AnswerRe: Thanks Dave Kreskowiak Pin
Pete O'Hanlon8-Mar-07 22:43
mvePete O'Hanlon8-Mar-07 22:43 
GeneralRe: Thanks Dave Kreskowiak Pin
balakpn9-Mar-07 2:33
balakpn9-Mar-07 2:33 
GeneralRe: Thanks Dave Kreskowiak Pin
Colin Angus Mackay9-Mar-07 2:56
Colin Angus Mackay9-Mar-07 2:56 
QuestioncHANGING THE DATAGRID HEADERTEXT AT RUNTIME IN VB.NET Pin
Member 39046948-Mar-07 21:10
Member 39046948-Mar-07 21:10 
AnswerRe: cHANGING THE DATAGRID HEADERTEXT AT RUNTIME IN VB.NET Pin
haggenx9-Mar-07 7:52
haggenx9-Mar-07 7:52 
QuestionmaskedTextBox, formatting for IP Address Pin
steve_rm8-Mar-07 21:08
steve_rm8-Mar-07 21:08 
AnswerRe: maskedTextBox, formatting for IP Address Pin
Johan Hakkesteegt8-Mar-07 21:53
Johan Hakkesteegt8-Mar-07 21:53 
Hi again Steve,

I am not sure, but I think the mask doesn't actually do anything with the input, it just shows the user an example.

One possibility to solve your problem (which I recommend) is to use four textboxes instead of one. Set their respective maximum lengths to 3, and use the following function to control input:
<br />
Public Function TrapKey(ByVal KCode As String) As Boolean<br />
Try<br />
If KCode < 48 Or KCode > 57 Then TrapKey = True<br />
'Add these if you want to allow commas, dots and such: And KCode <> 46 And KCode <> 8 And KCode <> 44<br />
Catch Ex As Exception<br />
Msgbox(Ex.message)<br />
End Try<br />
End Function<br />

Use TrapKey with the KeyPress event of a textbox:
Private Sub MyTextBox_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles MyTextBox.KeyPress<br />
e.Handled = TrapKey(Asc(e.KeyChar))<br />
End Sub


With this approach you allow the user to press tab to jump to the next number, and you can play around with the look of the textboxes, if you want it to look like a single field (no borders, etc).

it may not be the most elegant approach, but remember the difference between the American and Russian space programs?

Good luck,

Johan

My advice is free, and you may get what you paid for.

GeneralRe: maskedTextBox, formatting for IP Address Pin
steve_rm8-Mar-07 23:01
steve_rm8-Mar-07 23:01 
QuestionHELP!!! [modified] Pin
STIpro138-Mar-07 20:36
STIpro138-Mar-07 20:36 
AnswerRe: HELP!!! Pin
Marcus J. Smith9-Mar-07 2:35
professionalMarcus J. Smith9-Mar-07 2:35 
AnswerRe: HELP!!! Pin
Dave Kreskowiak9-Mar-07 5:15
mveDave Kreskowiak9-Mar-07 5:15 
Questioncode for searching files in ap.net Pin
sayyed mohid8-Mar-07 18:50
sayyed mohid8-Mar-07 18:50 
AnswerRe: code for searching files in ap.net Pin
Vasudevan Deepak Kumar9-Mar-07 7:15
Vasudevan Deepak Kumar9-Mar-07 7:15 
QuestionSolve plz..... Pin
Member 38798818-Mar-07 17:53
Member 38798818-Mar-07 17:53 
AnswerRe: Solve plz..... Pin
Christian Graus8-Mar-07 18:08
protectorChristian Graus8-Mar-07 18:08 
GeneralRe: Solve plz..... Pin
Member 38798818-Mar-07 18:17
Member 38798818-Mar-07 18:17 
GeneralRe: Solve plz..... Pin
Dave Kreskowiak9-Mar-07 5:11
mveDave Kreskowiak9-Mar-07 5:11 
Questioneditor urgent Pin
balakpn8-Mar-07 17:37
balakpn8-Mar-07 17:37 
QuestionChanging color of SSTab Pin
ArchaBhandare8-Mar-07 17:28
ArchaBhandare8-Mar-07 17:28 
AnswerRe: Changing color of SSTab Pin
Johan Hakkesteegt8-Mar-07 22:04
Johan Hakkesteegt8-Mar-07 22:04 
Questionhow to put a form in a form &lt; need help!! Pin
neodeaths8-Mar-07 14:25
neodeaths8-Mar-07 14:25 
AnswerRe: how to put a form in a form &lt; need help!! Pin
Guffa8-Mar-07 15:36
Guffa8-Mar-07 15:36 
GeneralRe: how to put a form in a form &lt; need help!! Pin
manni_n9-Mar-07 0:52
manni_n9-Mar-07 0:52 
GeneralRe: how to put a form in a form &lt; need help!! Pin
Guffa9-Mar-07 3:45
Guffa9-Mar-07 3:45 

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.