What's the correct way to do this?

  • Thread starter Thread starter vbMark
  • Start date Start date
V

vbMark

Here is what I have that is not working.


For x = 1 To m_intNumberOfFields

If m_oLabel(x).ParentOfComboBox = True Then
Dim ctrl As clsComboBox
Else
Dim ctrl As clsTextBox
End If

If ctrl(x).Text = "" Then
..
..
..
etc...

Do you see what I am trying to do? What is the correct way of doing this?

Thanks!!
 
vbMark said:
Here is what I have that is not working.


For x = 1 To m_intNumberOfFields

If m_oLabel(x).ParentOfComboBox = True Then
Dim ctrl As clsComboBox
Else
Dim ctrl As clsTextBox
End If

If ctrl(x).Text = "" Then
.
.
.
etc...

Do you see what I am trying to do? What is the correct way of doing this?


I am not sure if I understand what you want to archieve...

\\\
Dim Labels() As Label = {Label1, Label2, Label3, ...}
For Each Label As Label In Labels
Label.Text = ""
Next Label
///
 
if you place a "Dim" statement in an "If", it is recognized only until the
"End IF".
all controls derived from control have a text property, so write this:
Dim ctrl as Control
If m_oLabel(x).ParentOfComboBox = True Then
ctrl = new clsComboBox
Else
ctrl = new clsTextBox
End If
You also can't write "ctrl(x)". In a combobox you can write "ctrl.Items(x)"
 
Mark,

What is it what you want to achieve?

We don't know what are the next "whatevers" in your code

m_intNumberOfFields
m_oLabel(x).ParentOfComboBox
clsComboBox 'although this is probably an inherited combobox
clsTextBox 'the same as above

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top