Looping through selective controls
Looping through selective controls
Looping through selective controls
Looping through selective controls
Looping through selective controls
Looping through selective controls Looping through selective controls Looping through selective controls Looping through selective controls Looping through selective controls Looping through selective controls Looping through selective controls Looping through selective controls
Looping through selective controls Looping through selective controls
Looping through selective controls
Go Back  Xtreme Visual Basic Talk > > > Looping through selective controls


Reply
 
Thread Tools Display Modes
  #1  
Old 11-21-2012, 06:03 PM
akash_dad akash_dad is offline
Newcomer
 
Join Date: Nov 2012
Posts: 3
Question Looping through selective controls


Hello All,

I am a beginner in VB.NET, so please excuse me if you find my question stupid.

There are 4 sets of textboxs in the my Windows form. Their names are like below:
Set 1: HBD_NDT1, HBD_NDT2, HBD_NDT3, HBD_NDT4, HBD_NDT5
Set 2: HBD_NDP1, HBD_NDP2, HBD_NDP3, HBD_NDP4, HBD_NDP5
Set 3: HBD_UDT1, HBD_UDT2, HBD_UDT3, HBD_UDT4, HBD_UDT5
Set 4: HBD_UDP1, HBD_UDP2, HBD_UDP3, HBD_UDP4, HBD_UDP5

In the form I have four check boxes for each set of textboxs defined above. e.g. if user clicks on first check box than all the 5 textboxs of first set shall be enabled & so on...

Earlier, I made this application in MS Excel 2010 VBA editor. At that time i used following codes:

Code:
Private Sub Checkbox2_Change() Call Set_Design_Box("HBD_UDP", Me.Checkbox2.Value) End Sub Public Sub Set_Design_Box(ByVal Box_Name As String, ByVal Status As Boolean) Dim c As Integer If Status = True Then For c = 1 To 5 Me.Controls(Box_Name & c).Enabled = True Next Else For c = 1 To 5 Me.Controls(Box_Name & c).Enabled = False Next End If End Sub

Now, I am currently writing this codes in VBA 2010. Does anyone has idea how i can loop through selective textboxs using loops.

Please do help me.

Thanks in advance.

== Akash

Last edited by Gruff; 11-22-2012 at 10:01 PM. Reason: Removed color tags. Added vb tags
Reply With Quote
  #2  
Old 11-22-2012, 05:43 PM
akash_dad akash_dad is offline
Newcomer
 
Join Date: Nov 2012
Posts: 3
Default

Is there no here who can reply my question...?? :-(
Reply With Quote
  #3  
Old 11-22-2012, 09:58 PM
Gruff's Avatar
GruffLooping through selective controls Gruff is offline
Bald Mountain Survivor

Retired Moderator
* Expert *
 
Join Date: Aug 2003
Location: Oregon, USA - deceased
Posts: 6,440
Default

Where are you having trouble? Off hand your code looks like it should still work, although I would get rid of the "if" statement and use the Status variable directly.
Code:
For c = 1 To 5 Me.Controls(Box_Name & c).Enabled = Status Next
__________________
Burn the land and boil the sea
You can't take the sky from me


~T

Last edited by Gruff; 11-22-2012 at 10:13 PM.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Looping through selective controls
Looping through selective controls
Looping through selective controls Looping through selective controls
Looping through selective controls
Looping through selective controls
Looping through selective controls Looping through selective controls Looping through selective controls Looping through selective controls Looping through selective controls Looping through selective controls Looping through selective controls
Looping through selective controls
Looping through selective controls
 
Looping through selective controls
Looping through selective controls
 
-->