473,473 Members | 1,857 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Select Case TypeOf Control Possible?

12 New Member
Dear Friend,

I am trying to write code as the following-


Expand|Select|Wrap|Line Numbers
  1. For Each ControlObject As Control In Me.Controls
  2.     Select Case TypeOf ControlObject
  3.  
  4.          Case TextBox
  5.  
  6.          Case ComboBox
  7.  
  8.          Case Label
  9.  
  10.     End Select
  11. Next


But it says that "Is expected" after the second line. Is there any technique to do it?

Regards
SKPaul
Aug 10 '11 #1
2 3512
Dody
11 New Member
try this code
Expand|Select|Wrap|Line Numbers
  1.     For Each ControlObject As Control In Me.Controls
  2.  
  3.             If TypeOf (ControlObject) Is TextBox Then
  4.  
  5.             ElseIf TypeOf (ControlObject) Is ComboBox Then
  6.  
  7.             ElseIf TypeOf (ControlObject) Is Label Then
  8.  
  9.             End If
  10.     next
  11.  
  12.  
Aug 10 '11 #2
Saumitra Kumar Paul
12 New Member
Thanks Dody, Your soloution works nicely.
Aug 11 '11 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

19
by: Robert Scheer | last post by:
Hi. In VBScript I can use a Select Case statement like that: Select Case X Case 1 to 10 'X is between 1 and 10 Case 11,14,16 'X is 11 or 14 or 16 End Select
4
by: Terencetrent | last post by:
I having been using Access '97/2002 for about 4 years now and have never really had the need or the time to learn visual basic. Well, I think the time has finally come. I need help with Visual...
7
by: Lauren Quantrell | last post by:
Is there any speed/resource advantage/disadvantage in using Select Case x Case 1 Case 2 etc. many more cases... End Select VS.
2
by: William Gower | last post by:
I have a situation where I will display text boxes and labels depending on the user type of the user using this form. In the asp version I used a select case, but in the .net version I am putting...
6
by: BluDog | last post by:
Hi If i am using a Select... Case is there any way to have the elements of an array tested within a case, for example: Dim MyChar as Char Select Case MyChar Case "a"c, "b"c, "c"c 'Do...
4
by: Joe | last post by:
Hello All: I have some code that reads the names of XmlNodes and processes information accordingly. I just recived a new xml file that will now have a dynamic list of nodes with names like CC1,...
11
by: ME | last post by:
In C# the following code generates a compiler error ("A constant value is expected"): public void Test(string value) { switch (value) { case SimpleEnum.One.ToString(): MessageBox.Show("Test...
5
by: PJ6 | last post by:
Select Case o.GetType Case = GetType(SomeRandomTypeName) '... End Select Why doesn't this work? Can I make it work or am I stuck with ElseIf for a long list? Paul
1
by: microsoft.public.dotnet.languages.vb | last post by:
Hi All, I wanted to know whether this is possible to use multiple variables to use in the select case statement such as follows: select case dWarrExpDateMonth, dRetailDateMonth case...
4
by: troy_lee | last post by:
I have a form that acts a filter. All of the filtering objects are in the header and the results are displayed in a continuous form in the detail section. In the header, I have a text box...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.