473,320 Members | 2,071 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

What's the correct way to do this?

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!!
Nov 21 '05 #1
4 1076
"vbMark" <no@email.com> schrieb:
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
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #2
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)"

"vbMark" wrote:
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!!

Nov 21 '05 #3
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
Nov 21 '05 #4
Excellent, Thanks!

Also, thanks for the info on the combobox.

"=?Utf-8?B?QW1pcmFtIEtvcmFjaA==?="
<Am**********@discussions.microsoft.com> wrote in
news:07**********************************@microsof t.com:
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)"

"vbMark" wrote:
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...


Nov 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

137
by: Philippe C. Martin | last post by:
I apologize in advance for launching this post but I might get enlightment somehow (PS: I am _very_ agnostic ;-). - 1) I do not consider my intelligence/education above average - 2) I am very...
6
by: Zhang Weiwu | last post by:
Hello. I am working with a php software project, in it (www.egroupware.org) Chinese simplified locate is "zh" while Traditional Chinese "tw". I wish to send correct language attribute in http...
145
by: Mark Johnson | last post by:
Oddly enough, I found it difficult, using Google, to find a list of best-of sites based on the quality of their css packages. So I'd ask. Does anyone know of particularly good sites which are in...
7
by: Aguilar, James | last post by:
Hello all, To begin, yes, this -is- a homework assignment. However, it is for my Algorithms class, and my instructor has given us explicit permission to use "expert" groups like newsgroups, so...
1
by: Naga | last post by:
Hello, Thanks for the response Oleg. Now I need to know few answers. How do I get the value of a node using the xpath. I want the value of the MessageID and ResultCode from secondxml. And using...
6
by: Mark Broadbent | last post by:
this might sound like an obvious question but I have found that usually these two evolve at the same time. One of the biggest reasons for creating the abstraction in the first place (in my...
4
by: **Developer** | last post by:
I looked at MSDN and a book and both described the naming convention for parameters should be camel style. The book used camel, except for Set (ByVal Value as ...) There it always used an...
2
by: dasilva109 | last post by:
Hi guys I am new to C++ and need urgent help with this part of my code for a uni coursework I have to submit by Thursday //ClientData.h #ifndef CLIENTDATA_H #define CLIENTDATA_H #include...
8
by: nytimescnn | last post by:
I've read some discuession about lock() for thread-safe. I am wondering what will be the differce between below two code segment? Code 1: class A { private static Object padlock = new...
10
by: onetruelove | last post by:
I want to creat a post like this blog: http://onlinetoefltest.blogspot.com/2007/08/level-c-lesson-1.html When you chose all the answers and click show answer a msg box will appear and tells how...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.