|
-
Jun 5th, 2004, 12:39 PM
#1
Thread Starter
Frenzied Member
Typeof Problem
I tried to use the following code:
VB Code:
Dim ctrl as Control
For Each ctrl in grpInfo.Controls
If Typeof ctrl is TextBox Then
'hrmf
End If
Next
But When I get to the "hrmf" part, I don't have the ability to set/unset the Locked property of my Textbox control...
Any ideas on why?
Thanks,
Squirrelly1
Now happily married and still crankin' away at the keyboard.  Life is grand for a coder, no?
-
Jun 5th, 2004, 01:27 PM
#2
Hyperactive Member
I agree that I can find it at design time, but, effectively, I saw at 'members of textbox' and textbox class seems don't expose this property into its interface. So you can't do anything, directly, to change that 'disappeared property'. Perhaps there is an indirect way, some method ?.....I don't know!
Live long and prosper (Mr. Spock)
-
Jun 5th, 2004, 03:02 PM
#3
You still need to cast the object from the Control type to the TextBox type to see all of the members. Locked must not be visible because it probably isn't a member of the Control type.
Also if you are using VS 2003 then you don't need to declare the ctrl interator before hand.
VB Code:
For Each ctrl As Control in grpInfo.Controls
If Typeof ctrl is TextBox Then
DirectCast(ctrl,TextBox).Locked=True
End If
Next
-
Jun 6th, 2004, 03:23 AM
#4
Hyperactive Member
Perfect Edneeis....you explained it better than me!
Sometime I follow strange paths, trying to find the best english word to say something.
Anyway the problem stay here.....a single doubt:
You, Squirrelly, are the first one who try to modify that property at run time, for what I know, obviously.....so....(excuse me for this stupid question, but I saw many others, me too, to make the same mistake) is it possible you are trying to lock the textbox for user input? If it's so, you need to use 'readonly' property. Good job to you, dear friends.
Live long and prosper (Mr. Spock)
-
Jun 6th, 2004, 09:26 AM
#5
Thread Starter
Frenzied Member
That's fine and well. I actually did start using the "Readonly" attribute to stop people from using the textbox for input, but it changes the color of the textbox. Is there any way to keep it from doing that?
I should figured that locked was a design-time property... With the whole "Lock Controls" option and the fact that it is under the "Design" category. 
Thanks for your help,
Squirrelly1
Now happily married and still crankin' away at the keyboard.  Life is grand for a coder, no?
-
Jun 6th, 2004, 09:57 AM
#6
Hyperactive Member
Yes Squirrelly, your problem it's solved!
You only need to change the background color of the textbox, choosing explicitly the one you desire. If you design your textbox choosing background color = white, it remains steady. It changes only if you let the default management of colours!
Good job and welcome in the community of the men that confused locked and readonly properties. I'm the founder and actually president!
Good job!
Live long and prosper (Mr. Spock)
-
Jun 7th, 2004, 10:12 AM
#7
Thread Starter
Frenzied Member
LOL. Thank you EVER so much! When do I get my membership card? (I sincerely hope there aren't any dues... I kinda have to get this project done before I have any spare cash to speak of) 
Thanks again guys,
Squirrelly1
Now happily married and still crankin' away at the keyboard.  Life is grand for a coder, no?
-
Jun 7th, 2004, 11:30 AM
#8
Hyperactive Member
Memebership card is free for you. You are a president's friend !!!
Live long and prosper (Mr. Spock)
-
Jun 7th, 2004, 02:24 PM
#9
Thread Starter
Frenzied Member
He he. I wish that were true with a couple of the other clubs I'm a member of...
VB-Newbs4Life
&
The Access 4 The UnAccessable Mind Assoc.
Wanna Join? 
Squirrelly1
Now happily married and still crankin' away at the keyboard.  Life is grand for a coder, no?
-
Jun 8th, 2004, 02:41 AM
#10
Hyperactive Member
Surely !!! Send me the coupon I have to fill 
Dear squirrelly, in this thread we have demonstrated that is possible (and better) to smile while learning. I think it's the right way to use a forum. We have to help each other (is this right english? ) and try to be friends, if possible. It happens, I think, if we are able to smile, also about our mistakes, as you and I were able to do! We have also learned, from the Edneeis ( I followed many threads in which He was involved and I know He's not a newbie like me) that early binding is a good practice. Probably I should turn Option strict to ON on my project !
The next project I'll develop, It will be with option strict on, this is a Boy Scout Promise!
Bye and good job (excuse my english, anyway)
Live long and prosper (Mr. Spock)
-
Jun 8th, 2004, 09:48 AM
#11
Thread Starter
Frenzied Member
Darn Right!!!
Chao ,
Squirrelly1
Now happily married and still crankin' away at the keyboard.  Life is grand for a coder, no?
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
|