473,785 Members | 2,283 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Nested If

I have 2 if statements that are unrelated to each other,
but the outcome of the variable of each of these are.
Here is my first one:

If sToEMail = "" Then
sTo = "DT" & CStr(lDistrictN br)"@microsoft. com"
Else
sTo = sToEMail
End If

Then my second one:

If iCall_Type = 9 Then
sTo = sCmd
End if

Both IF's need to be evaluated, but not sure how to
handle this with the outcome of the sTo variable.

Help?

Thanks!
Nov 20 '05 #1
9 1350
Hi,

What is sCmd?

In any case, it seems straightforward - if this is the code sequence, sTo
ends up being the designated email address or sCmd. What am I missing here?

Bernie

"Thanks2U" <an*******@disc ussions.microso ft.com> wrote in message
news:00******** *************** *****@phx.gbl.. .
I have 2 if statements that are unrelated to each other,
but the outcome of the variable of each of these are.
Here is my first one:

If sToEMail = "" Then
sTo = "DT" & CStr(lDistrictN br)"@microsoft. com"
Else
sTo = sToEMail
End If

Then my second one:

If iCall_Type = 9 Then
sTo = sCmd
End if

Both IF's need to be evaluated, but not sure how to
handle this with the outcome of the sTo variable.

Help?

Thanks!

Nov 20 '05 #2

"Thanks2U" <an*******@disc ussions.microso ft.com> wrote in message
news:00******** *************** *****@phx.gbl.. .
I have 2 if statements that are unrelated to each other,
but the outcome of the variable of each of these are.
Here is my first one:

If sToEMail = "" Then
sTo = "DT" & CStr(lDistrictN br)"@microsoft. com"
Else
sTo = sToEMail
End If

Then my second one:

If iCall_Type = 9 Then
sTo = sCmd
End if

Both IF's need to be evaluated, but not sure how to
handle this with the outcome of the sTo variable.

Help?

Thanks!


If iCall_Type = 9 Then
sTo = sCmd
ElseIf sToEmail = "" Then
sTo = "DT" & CStr(lDistrictN br) & "@microsoft.com "
Else
sTo = sToEMail
End If

Is this what you need?

Mythran
Nov 20 '05 #3
* "Thanks2U" <an*******@disc ussions.microso ft.com> scripsit:
I have 2 if statements that are unrelated to each other,
but the outcome of the variable of each of these are.
Here is my first one:

If sToEMail = "" Then
sTo = "DT" & CStr(lDistrictN br)"@microsoft. com"
Else
sTo = sToEMail
End If

Then my second one:

If iCall_Type = 9 Then
sTo = sCmd
End if

Both IF's need to be evaluated, but not sure how to
handle this with the outcome of the sTo variable.


\\\
If ... Then
...
ElseIf ... Then
...
ElseIf ... Then
...
End If
///

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #4
He indicated that both If's need to be evaluated. In yours,

ElseIf sToEmail = "" Then

will not be tested if: iCall_Type = 9

"Mythran" <ki********@hot mail.com> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..

"Thanks2U" <an*******@disc ussions.microso ft.com> wrote in message
news:00******** *************** *****@phx.gbl.. .
I have 2 if statements that are unrelated to each other,
but the outcome of the variable of each of these are.
Here is my first one:

If sToEMail = "" Then
sTo = "DT" & CStr(lDistrictN br)"@microsoft. com"
Else
sTo = sToEMail
End If

Then my second one:

If iCall_Type = 9 Then
sTo = sCmd
End if

Both IF's need to be evaluated, but not sure how to
handle this with the outcome of the sTo variable.

Help?

Thanks!


If iCall_Type = 9 Then
sTo = sCmd
ElseIf sToEmail = "" Then
sTo = "DT" & CStr(lDistrictN br) & "@microsoft.com "
Else
sTo = sToEMail
End If

Is this what you need?

Mythran

Nov 20 '05 #5
Cor
I did not understand the question, now I saw the message from Scott I
understand it.

If sToEMail = "" Then
sTo = "DT" & CStr(lDistrictN br)"@microsoft. com"
Else

If iCall_Type = 9 Then
sTo = sCmd
else
sTo = sToEMail
End if
///

Cor
Nov 20 '05 #6
I still don't think that this will satisfy the original requirement that
both if statements be evaluated. In yours, if:

oEMail = ""

then iCall_Type will not be tested for 9.

I think he just needs the 2 if statements, one after the other.

His original post showed him ussing:

If sToEMail = "" Then
sTo = "DT" & CStr(lDistrictN br)"@microsoft. com"
Else
sTo = sToEMail
End If

If iCall_Type = 9 Then
sTo = sCmd
End if

This seems to be correct to me. The question now becomes, which if is more
important than the other. If he has one variable that will be changed by
one of 2 other variable values, then is it more important that sTo be sCmd
when iCall_Type is 9 or not. The order of the if statements may need to be
reversed.

"Cor" <no*@non.com> wrote in message
news:Oq******** ******@tk2msftn gp13.phx.gbl...
I did not understand the question, now I saw the message from Scott I
understand it.

If sToEMail = "" Then
sTo = "DT" & CStr(lDistrictN br)"@microsoft. com"
Else

If iCall_Type = 9 Then
sTo = sCmd
else
sTo = sToEMail
End if
///

Cor

Nov 20 '05 #7
Cor
In your sample will the previous test be for nothing if cmd = 9

If the 9 test would be the most important, than it should in my example have
to change place with the test for space
I still don't think that this will satisfy the original requirement that
both if statements be evaluated. In yours, if:

Nov 20 '05 #8
Not sure what test you mean by "previous test", but in my example (actually
the original post's example), both tests are carried out.

I just don't see how your nested If test in the Else section would be
carried out if the first If returns true.
"Cor" <no*@non.com> wrote in message
news:Om******** ******@TK2MSFTN GP10.phx.gbl...
In your sample will the previous test be for nothing if cmd = 9

If the 9 test would be the most important, than it should in my example have to change place with the test for space
I still don't think that this will satisfy the original requirement that
both if statements be evaluated. In yours, if:


Nov 20 '05 #9
Cor
There is a typo in, but I asume that you did see that the last "end if" was
missing.
If sToEMail = "" Then
(if there is no emailadres send a mail to microsoft)
sTo = "DT" & CStr(lDistrictN br)"@microsoft. com"
(if there is an mail adres than do something else)
Else If iCall_Type = 9 Then

(if it is a Icall, let say intern, than do this)
sTo = sCmd
else
(send to the email adres)
sTo = sToEMail
end if
End if
///Not sure what test you mean by "previous test", but in my example (actually
the original post's example), both tests are carried out. I just don't see how your nested If test in the Else section would be
carried out if the first If returns true.


Nov 20 '05 #10

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

Similar topics

0
2886
by: Glen | last post by:
I have a Struts action form which contains a bean. I am trying to display a bean retrieved from the database in this form using the nested tag. Can anyone help me? I continue to get an error message see end for stack trace. Struts config <form-bean name="newBean" type="com.NewForm" /> ...... <action path="/new-action" type="com.NewAction" name="newBean" scope="session">
6
2569
by: Andy Baker | last post by:
Hi there, I'm learning Python at the moment and trying to grok the thinking behind it's scoping and nesting rules. I was googling for nested functions and found this Guido quote: (http://www.python.org/search/hypermail/python-1993/0343.html) "This is because nested function definitions don't have access to the local variables of the surrounding block -- only to the globals of the
3
2407
by: Erik Bongers | last post by:
Hi, Nested classes only seem to be able to access static members of the surrounding class : class SurroundingClass { public: class InnerClass { public:
10
3246
by: nimmi_srivastav | last post by:
Below you will see an example of a nested conditional expression that this colleague of mine loves. He claims that it is more efficient that a multi-level if-else-if structure. Moreover, our complexity analyzer tool supposedly does not pick it up. Is it really more efficient? Personally I find this coding style extremely cryptic, misleading and error-prone. I believe that I have removed all traces of proprietary-ness from this coding...
6
559
by: B0nj | last post by:
I've got a class in which I want to implement a property that operates like an indexer, for the various colors associated with the class. For instance, I want to be able to do 'set' operations like MyClass.MyColors = Color.Green or, a 'get', such as Color forecolor = MyClass.MyColors; I want to use an indexer so I can take parameters, such as the color type (e.g. "Foreground", "Background" etc.). With a single member function I couldn't...
8
16921
by: Robert W. | last post by:
I've almost completed building a Model-View-Controller but have run into a snag. When an event is fired on a form control I want to automatically updated the "connnected" property in the Model. This works fine if all of the properties are at the top (root level) of the model but I'd like to keep them in nested classes to organize them better. So, for example, part of my data model looks like this (simplified) : public class MainClass
1
2131
by: Tomas Sieger | last post by:
Hi all, I'm in doubt with the following code: class Base { public: class Nested {}; }; class Derived:public Base { public: class Nested {
77
5250
by: Peter Olcott | last post by:
http://www.tommti-systems.de/go.html?http://www.tommti-systems.de/main-Dateien/reviews/languages/benchmarks.html The above link shows that C# is 450% slower on something as simple as a nested loop. Is this because .NET is inherently slower or does the C# compiler merely produce code that is not as well optimized as the C++ compiler?
7
3645
by: patrick j | last post by:
Hi I'm wondering about lists with nested lists as one does on a Saturday afternoon. Anyway below is an example of a list with a nested list which the iCab browser's very useful HTML verification ability will not like: <ul> <li><a href="#">link</a></li>
3
3887
by: jdurancomas | last post by:
Dear all, I'm trying to declare the operator++ to a nested class. The nested class is not template but the container it is. The code used in teh sample program is included bellow: #include <iostream>
0
9483
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10157
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10096
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9956
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5386
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5514
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4055
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 we have to send another system
2
3658
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2887
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.