Linking together the same type of Objects

Chops
03-23-2007, 01:10 PM
Alrighty, I've Googled around, tried some codes of my own, and asked one of my friends, but I have not found and answer, so I'm hopin' everyone on here can help me out.

I'm new to VB however I know a few other programing languages, so I have a general knoledge of what I'm doing.

Anywho, Basically, what I'm trying to do is make 43 Check Boxes (Don't Ask) linked together somehow where I can click a Command button and clear them all off... i know of atleast one very basic way of doing it, but I don't want to write:

Private Sub Blah_Click()
ChkSomething.Value = 0
ChkSomethingElse.Value = 0
ChkSoOn.Value = 0
End Sub


Also, I'm hoping that can help me with this (Mostly in the Linking Together Part), but I kinda want to do a similar thing with all my Text Boxes. Not Disabling them or making them the same text, but basically, I want them to carry the same if, which is a Integer, Delete, and Backspace KeyAscii only code, which is as Follows:

If KeyAscii = 6 Or KeyAscii = 8 Then Exit Sub
If KeyAscii < 48 Or KeyAscii > 57 Then KeyAscii = 0

So basically, I want All 43 Text Boxes to be Integer Only, but without writing a Sub for each TextBox.

From what I've seen, VB is a little weak in some areas like this, so if there is nothing I can do about it, then that's good, but otherwise I thank anyway ahead of time just for reading my long post! Thanks.

- Chops

Chops
03-23-2007, 01:42 PM
Oh yeah, and on the TextBoxes, one other thing aswell, I found one way to do it now, however, it's kidna not what I need... Putting the Names as an Array don't work for me.. I Need each and every name to be different instead of the control Array Number. So a Control Array for the TextBoxes Name is out aswell... This is going to be my Last resort though... ~~

loquin
03-23-2007, 01:45 PM
Dim chk as Control

For Each chk in me
if TypeOf chk is Checkbox then
chk.Value = vbUnchecked
End If
Next chk

I AM curious as to why you don't want to use a control array, though.

Chops
03-23-2007, 01:59 PM
Awsome, Thanks for the code, it works perfectly, both Checking and Unchecking, merly put and Extra If Checked/Unchecked then Uncheck/Check.

Well... See, It's not a BIG Issue... More or less a personal one... Number one, I have a horible memory, and eventually when I get done, I'm going to have to use the information in a save file, and to do so as I need/want it, I need it to have it's own special name so it doesn't effect the lager program that will be using the files this one is creating. Like I said, I Well use it if it comes down to it, but I think now that I see how that code you gave me works, I may be able to modify it for my Text Boxes.

Thanks alot for the Code!

Chops
03-23-2007, 02:08 PM
Really, the Main thing I would like to know, and if this isn't posible, something of the sorts would help. But Anyway, If I could make the program pay attintion to if any TextBox is typed in to... then... It runs my Integer only thing.

OH! One thing that I just remembered that may REALLY help you out... haha, I kinda forgot about this, but it IS ALL of the TextBoxes on the Form. haha, sorry about that.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum