|
-
May 27th, 2007, 03:34 AM
#1
Thread Starter
Hyperactive Member
Validation TextBox in Loop (Collection) ? A still no solved
Hi
Again, the same problem, a still no solved.
Already I have the procedure however I will want to use to all TextBoxes
in my app using to this collection.
Code:
Option Explicit
Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer)
Text1(Index).MaxLength = 5 '<<< it specifies the amount of signs
If KeyAscii = 13 Then '<<< exceptionally do it permit for Enter key
SendKeys "{tab}"
KeyAscii = 0
ElseIf KeyAscii <> 8 Then '<<< or for BackSpace key
'<<< if is comma
'<<< then block for next the comma and other non-numeric signs
If InStr(1, Text1(Index), ",") And KeyAscii = 44 Then KeyAscii = 0
If Not IsNumeric(Chr$(KeyAscii)) And KeyAscii <> 44 Then
MsgBox "ONLY numbers", vbCritical + vbOKOnly, "Attention !"
KeyAscii = 0
End If
End If
'<<< however when first the sign it's comma then add sign an zero
If Mid$(Text1(Index), 1, 1) = "," Then
Text1(Index).Text = "0" & Text1(Index).Text
Text1(Index).SelStart = Len(Text1(Index))
End If
This code working fine but... for the array controls
Thanks in advance
BTW: how to protect before use of pasted value - I think there is no sense to prevent an pasting this. Rather necessary it will be a some the procedure to checking the values. How to make?
Last edited by Tamgovb; Jun 1st, 2007 at 10:17 AM.
I know, I know, my English is bad, sorry .....
-
May 28th, 2007, 12:38 PM
#2
Thread Starter
Hyperactive Member
Re: Validation TextBox in Loop (Collection) What is bad?
Hello, knock, knock - someone know?
Last edited by Tamgovb; May 28th, 2007 at 12:43 PM.
I know, I know, my English is bad, sorry .....
-
May 29th, 2007, 08:04 AM
#3
Re: Validation TextBox in Loop (Collection) What is bad?
To code against pasting, use the checkboxs Change Event.
-
Jun 1st, 2007, 10:18 AM
#4
Thread Starter
Hyperactive Member
Re: Validation TextBox in Loop (Collection) ? A still no solved
Hi All
Please me help, it's urgent for me.
Look in my first post
Thanks
I know, I know, my English is bad, sorry .....
-
Jun 1st, 2007, 10:30 AM
#5
Re: Validation TextBox in Loop (Collection) ? A still no solved
What exactly is the problem? Also plaese don't bump your threads.
-
Jun 1st, 2007, 10:58 AM
#6
PowerPoster
Re: Validation TextBox in Loop (Collection) ? A still no solved
Martin, it was a fair bump IMO...he waited at least 24 hours and he got no reply...I know there's nothing in the rules for here that says 24 hours, but at least the guy waited for an answer :-)
Tam, if you want to protect against pasted values (people using cut and paste to paste in a number getting around keypress) you would use the text1_change event and validate the text in that textbox to make sure it fits with the rules you require :-)
The rest of your problems I can't help with...I've got *NO* idea whatsoever what you need
Well, everyone else has been doing it :-)
Loading a file into memory QUICKLY - Using SendKeys - HyperLabel - A highly customisable label replacement - Using resource files/DLLs with VB - Adding GZip to your projects
Expect more to come in future
If I have helped you, RATE ME! :-)
I love helping noobs with their VB problems (probably because, as an amateur programmer, I am only slightly better at VB than them :-)) but if you SERIOUSLY want to get help for free from a community such as VBForums, you have to first have a grounding (basic knowledge) in VB6, otherwise you're way too much work to help...You've got to give a little if you want to get help from us, in other words!
And we DON'T do your homework. If your tutor doesn't teach you enough to help you make the project without his or her help, FIND A BETTER TUTOR or try reading books on programming! We are happy to help with minor things regarding the project, but you have to understand the rest of it if you want our help to be useful.
-
Jun 1st, 2007, 11:03 AM
#7
Re: Validation TextBox in Loop (Collection) ? A still no solved
 Originally Posted by smUX
Martin, it was a fair bump IMO...he waited at least 24 hours and he got no reply...I know there's nothing in the rules for here that says 24 hours, but at least the guy waited for an answer :-)....
Imagine the mess if everyone who "waited at least 24 hours" fought to keep their threads on page 1. Because of that we discourage bumping and we have banned people who repeatedly ignore requests not to bump.
-
Jun 1st, 2007, 11:07 AM
#8
PowerPoster
Re: Validation TextBox in Loop (Collection) ? A still no solved
 Originally Posted by MartinLiss
Imagine the mess if everyone who "waited at least 24 hours" fought to keep their threads on page 1. Because of that we discourage bumping and we have banned people who repeatedly ignore requests not to bump.
But if everyone who never got a reply bumped their thread, it would be the same as them copying and pasting the post and reposting it, which would be allowed. Now I understand if someone bumps their thread to keep it popular, they should be banned, nuked, flamed and many other things...but if the post was never popular in the first place and no-one responded...you see what I am saying? Couldn't it just be treated as if the person reposted it?
I'll not talk any more about this...disagree or not, you're one of the ones in charge here :-)
Well, everyone else has been doing it :-)
Loading a file into memory QUICKLY - Using SendKeys - HyperLabel - A highly customisable label replacement - Using resource files/DLLs with VB - Adding GZip to your projects
Expect more to come in future
If I have helped you, RATE ME! :-)
I love helping noobs with their VB problems (probably because, as an amateur programmer, I am only slightly better at VB than them :-)) but if you SERIOUSLY want to get help for free from a community such as VBForums, you have to first have a grounding (basic knowledge) in VB6, otherwise you're way too much work to help...You've got to give a little if you want to get help from us, in other words!
And we DON'T do your homework. If your tutor doesn't teach you enough to help you make the project without his or her help, FIND A BETTER TUTOR or try reading books on programming! We are happy to help with minor things regarding the project, but you have to understand the rest of it if you want our help to be useful.
-
Jun 1st, 2007, 11:10 AM
#9
Re: Validation TextBox in Loop (Collection) ? A still no solved
 Originally Posted by smUX
But if everyone who never got a reply bumped their thread, it would be the same as them copying and pasting the post and reposting it, which would be allowed. Now I understand if someone bumps their thread to keep it popular, they should be banned, nuked, flamed and many other things...but if the post was never popular in the first place and no-one responded...you see what I am saying? Couldn't it just be treated as if the person reposted it?
I'll not talk any more about this...disagree or not, you're one of the ones in charge here :-)
No, reposting is also discouraged and I'll be happy to discuss this further via PMs if you like.
-
Jun 1st, 2007, 01:40 PM
#10
Thread Starter
Hyperactive Member
Re: Validation TextBox in Loop (Collection) ? A still no solved
Sorry Martin for confusion but I didn't want here to create new thread. I thought that so will be it better. I didn't want to be in forefront of threads but only wanted restore this theme. I made this a first once and...a last once, OK. I understand it. My mistake. So.. coming back to theme this.
This code does validation for all textbox's but ONLY on a one form. And I want so to make it in whole my app. I don't know it's possible? How to make?
My second question it’s like this:
How to protect before pasting values - however I think there is no sense to prevent an pasting this directly in textbox . Rather probably necessary it will be a some the procedure inside code to checking the values.
thanks in advance
I know, I know, my English is bad, sorry .....
-
Jun 1st, 2007, 02:45 PM
#11
Re: Validation TextBox in Loop (Collection) ? A still no solved
To have that code work for textboxes on more than one form you should add a new Sub to a code module that takes a textbox and an index value as inputs and then call that sub from wherever you want to.
Better parhaps might be to download and compile my NumberBox ActiveX control (you'll find a link in my signature). That already does what you want.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|