473,383 Members | 1,759 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,383 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 1161
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...

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.