473,396 Members | 1,894 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,396 software developers and data experts.

"if" question

Hello,

i have this code line in a script in my ASP.net / VB web site:

if msgNewsletterAction = "Go" Then
code1
Else
code2
End If

code2 runs everytime even when msgNewsletterAction = "Go". code1 never runs.

What is wrong in my sintax?

Thank You,
Miguel
Nov 20 '05 #1
7 993
Miguel,

You need to verify that msgNewsletterAction actually equals "Go" - not "go"
or "go " or " Go". Check the length to be sure it is 2 characters long. The
is not syntax issue.

bill burrows

"Miguel Dias Moura" <in************@27lamps.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hello,

i have this code line in a script in my ASP.net / VB web site:

if msgNewsletterAction = "Go" Then
code1
Else
code2
End If

code2 runs everytime even when msgNewsletterAction = "Go". code1 never runs.
What is wrong in my sintax?

Thank You,
Miguel

Nov 20 '05 #2
Try this,

if trim(Ucase(msgNewsletterAction)) =trim(ucase("Go")) Then
code 1
else
code 2
end if
"Miguel Dias Moura" <in************@27lamps.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hello,

i have this code line in a script in my ASP.net / VB web site:

if msgNewsletterAction = "Go" Then
code1
Else
code2
End If

code2 runs everytime even when msgNewsletterAction = "Go". code1 never runs.
What is wrong in my sintax?

Thank You,
Miguel

Nov 20 '05 #3
Hi Miqual,

Mostly in this cases it is that the string is just empty.

Nicer is by the way to make msgNewsLetterAction a Boolean instead of a
String and set it to True or False, than it can be

\\\
if msgNewsletterAction Then
code1
Else
code2
End If
///

I hope this helps?

Cor
Nov 20 '05 #4
try this

if msgNewsletterAction.Equals("Go") Then
code1
Else
code2
End If

Dominique

"Miguel Dias Moura" <in************@27lamps.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hello,

i have this code line in a script in my ASP.net / VB web site:

if msgNewsletterAction = "Go" Then
code1
Else
code2
End If

code2 runs everytime even when msgNewsletterAction = "Go". code1 never runs.
What is wrong in my sintax?

Thank You,
Miguel

Nov 20 '05 #5
Hi,

i declared the variable as follows:

dim msgNewsletterAction

then i got the value from a form:

msgNewsletterAction = Request.Form("newsletterAction")

then i sent the value to an email using AspNetEmail. I readed my email and
there it was...the word "Go".

This is why this is so strange.

Thanks,
Miguel

"Dominique Vandensteen" <domi.vds_insert@tralala_tenforce.com> wrote in
message news:ul*************@TK2MSFTNGP10.phx.gbl...
try this

if msgNewsletterAction.Equals("Go") Then
code1
Else
code2
End If

Dominique

"Miguel Dias Moura" <in************@27lamps.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hello,

i have this code line in a script in my ASP.net / VB web site:

if msgNewsletterAction = "Go" Then
code1
Else
code2
End If

code2 runs everytime even when msgNewsletterAction = "Go". code1 never

runs.

What is wrong in my sintax?

Thank You,
Miguel


Nov 20 '05 #6
Declaring msgNewsletterAction like that makes it an object. You may
need to convert it into a string type so you can evaluate it properly.
Miguel Dias Moura wrote:
Hi,

i declared the variable as follows:

dim msgNewsletterAction

then i got the value from a form:

msgNewsletterAction = Request.Form("newsletterAction")

then i sent the value to an email using AspNetEmail. I readed my email and
there it was...the word "Go".

This is why this is so strange.

Thanks,
Miguel

"Dominique Vandensteen" <domi.vds_insert@tralala_tenforce.com> wrote in
message news:ul*************@TK2MSFTNGP10.phx.gbl...
try this

if msgNewsletterAction.Equals("Go") Then
code1
Else
code2
End If

Dominique

"Miguel Dias Moura" <in************@27lamps.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl.. .
Hello,

i have this code line in a script in my ASP.net / VB web site:

if msgNewsletterAction = "Go" Then
code1
Else
code2
End If

code2 runs everytime even when msgNewsletterAction = "Go". code1 never


runs.
What is wrong in my sintax?

Thank You,
Miguel



Nov 20 '05 #7
I think Request.Form("newsletterAction") returns a String

so try:

Dim msgNewsletterAction as String
msgNewsletterAction = Request.Form("newsletterAction")

If msgNewsletterAction.Equals("Go") Then
code1
Else
code2
End If

"Miguel Dias Moura" <in************@27lamps.com> wrote in message
news:up**************@TK2MSFTNGP10.phx.gbl...
Hi,

i declared the variable as follows:

dim msgNewsletterAction

then i got the value from a form:

msgNewsletterAction = Request.Form("newsletterAction")

then i sent the value to an email using AspNetEmail. I readed my email and
there it was...the word "Go".

This is why this is so strange.

Thanks,
Miguel

"Dominique Vandensteen" <domi.vds_insert@tralala_tenforce.com> wrote in
message news:ul*************@TK2MSFTNGP10.phx.gbl...
try this

if msgNewsletterAction.Equals("Go") Then
code1
Else
code2
End If

Dominique

"Miguel Dias Moura" <in************@27lamps.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hello,

i have this code line in a script in my ASP.net / VB web site:

if msgNewsletterAction = "Go" Then
code1
Else
code2
End If

code2 runs everytime even when msgNewsletterAction = "Go". code1 never

runs.

What is wrong in my sintax?

Thank You,
Miguel



Nov 20 '05 #8

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

Similar topics

9
by: LRW | last post by:
I'm not exactly sure how to even ask the question, and I know my terminology is not good as I'm a SQL beginner, but, here goes. I need to find a way to make an if statement within an array...or,...
15
by: D E | last post by:
Ok the subject line is basically the question. Obviously this won't work. What is the technical reason? Is it because here, "test1" is sort of like a static object now? What exactly is "test1"...
145
by: Sidney Cadot | last post by:
Hi all, In a discussion with Tak-Shing Chan the question came up whether the as-if rule can cover I/O functions. Basically, he maintains it can, and I think it doesn't. Consider two...
35
by: David Cleaver | last post by:
Hello all, I was wondering if there were some sort of limitations on the "if" statement? I'm writing a program which needs to check a bunch of conditions all at the same time (basically). And...
12
by: junky_fellow | last post by:
Which is better using a switch statement or the if-then equivalent of switch ?
3
by: sapnsapn | last post by:
Hi folks, I am looking at an application written in C some 10+ years ago. There is a lot of such if statements: if (my_number) {....} else {...} Here, my_number is an unsigned int. What exactly...
3
by: Chris | last post by:
Hi, 1) In file test.aspx, i put: <%@ Page Language="VB" AutoEventWireup="false" CodeFile="test.aspx.vb" Inherits="test" %> <%@ import namespace="System.Data"%> <%@ import...
2
by: naughtybynature | last post by:
<html> <head> <title>Search Questions</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <?php $query = '';
1
by: naughtybynature | last post by:
<html> <head> <title>Search Questions</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <?php $query = '';
37
by: jht5945 | last post by:
For example I wrote a function: function Func() { // do something } we can call it like: var obj = new Func(); // call it as a constructor or var result = Func(); // call it as...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
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
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...

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.