473,414 Members | 1,606 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,414 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 18 '05 #1
4 1163
AT
"Miguel Dias Moura" <in************@27lamps.com> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
Hello,

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

How msgNewsletterAction is declared?
Try msgNewsletterAction.ToString()

But msgNewsletterAction can be anything so please add info

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 18 '05 #2
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

"AT" <an*****@avwork.com> wrote in message
news:eJ**************@TK2MSFTNGP11.phx.gbl...
"Miguel Dias Moura" <in************@27lamps.com> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
Hello,

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

How msgNewsletterAction is declared?
Try msgNewsletterAction.ToString()

But msgNewsletterAction can be anything so please add info

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 18 '05 #3
you need to declare as a string if you are checking for a string, I think you have it as a variant type so could try .toString but would be better to delcare a correct type
Nov 18 '05 #4
How can i declare it as a sting?

Thank You,
Miguel

"Martin" <an*******@discussions.microsoft.com> wrote in message
news:A8**********************************@microsof t.com...
you need to declare as a string if you are checking for a string, I think

you have it as a variant type so could try .toString but would be better to
delcare a correct type
Nov 18 '05 #5

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
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?
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
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...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.