473,462 Members | 1,243 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

"if" problem. Still. Value is ok.

Hi,

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

dim msgNewsletterAction

msgNewsletterAction = Request.Form("newsletterAction")

if msgNewsletterAction = "go" Then
Code1
Else
Code2
End If

Code2 runs everytime even when msgNewsletterAction = "go". Code1 never runs.

I sent the value of msgNewsletterAction to an email address using
AspNetEmail.
I readed my email and the value of the variable was correct and equal to
"go".

So why doesn't Code1 runs?

Thanks,
Miguel
Nov 18 '05 #1
2 1149
There are somethings you can try.

(1) Trim it :- Trim(Request.Form("newsletterAction")
(2) Make a less specific request :- Request("newsletterAction"
(3) Combine above two :- Trim(Request("newsletterAction")
(4) Show us the forms on the we
(5) Response.Write("***" & Trim(Request("newsletterAction")) & "***"

With (5) you can see if there are any space comign through (e.g. "go ") which would cause the If to evaluate to fals

Rasika Wijayaratne
Nov 18 '05 #2
You can also try this
(6) LCase(Trim(Request("newsletterAction"))), just to ensure the requested value is lowercase before the comparison is done. LCase function makes the parameter string into lowe case

Rasika Wijayaratn

Nov 18 '05 #3

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

Similar topics

3
by: Chris Tilley - HPC:Factor | last post by:
Hi, I'm utterly confounded by this one. There must be some sort of rule that I don't know of. I'd consider myself a Newbie+1, so be gentle. I have a database connection (working A-Ok) and a...
40
by: Steve Juranich | last post by:
I know that this topic has the potential for blowing up in my face, but I can't help asking. I've been using Python since 1.5.1, so I'm not what you'd call a "n00b". I dutifully evangelize on the...
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...
3
by: Mark Sullivan | last post by:
When I trace through a csharp program I came to a situation where a certain values has an "undefined value" as shown in the debugger DbgClr. I want to check this but the following statements did...
4
by: Miguel Dias Moura | last post by:
Hi, i have this code line in a script in my ASP.net / VB web site: dim msgNewsletterAction msgNewsletterAction = Request.Form("newsletterAction") if msgNewsletterAction = "go" Then Code1
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...
4
by: cwoll | last post by:
I am runing this function to toggle buttens to display an "X" when they is selected, the butten is linked to a yes/no field. This function works good, the problem I am having is that when I make a...
0
by: eyalhz | last post by:
I have this code at button click: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If ListBox1.SelectedIndex() Then Dim lines As...
13
by: Jim in Arizona | last post by:
I made a page with a gridview that has rows show a different color if a number in a column is greater than or equal to 45. I also did this conditional formatting for the column next to it. Here's...
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: 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,...
1
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...
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
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.