If ... NOT "" Then .... question

Discussion in 'ASP General' started by David Aldred, Nov 22, 2004.

  1. David Aldred

    David Aldred Guest

    Got a bit of code, which I want to loop through, unless the current value is
    "", in which case I need ti to skip to the next one, but how do I do it?

    Response.Write "<br />" & vbCrLf
    For Each strItem In Request.Form
    If strItem = "" THEN
    'these next two lines, I only want to be processed if the above does
    have a value in it.
    Response.Write "-" & strItem & "-" & vbCrLf
    Response.Write "-" & Request.Form(strItem) & "<br />" & vbCrLf
    End If
    Next
    Response.Write "<br />" & vbCrLf


    Regards
    David
     
    David Aldred, Nov 22, 2004
    #1
    1. Advertising

  2. David Aldred wrote:
    > Got a bit of code, which I want to loop through, unless the current
    > value is "", in which case I need ti to skip to the next one, but how
    > do I do it?
    >
    > Response.Write "<br />" & vbCrLf
    > For Each strItem In Request.Form


    strItem, being the key to the Form variables collection, will NEVER be
    blank. I suspect you actually want to test the content of the Form
    variables, rather than the variable names. To do that, you would do this:

    For each key in request.form
    strItem = Request.Form(key)

    > If strItem = "" THEN


    Bob Barrows
    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.
     
    Bob Barrows [MVP], Nov 22, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?TWlrZQ==?=

    greater then / less then

    =?Utf-8?B?TWlrZQ==?=, Nov 4, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    1,593
    Kevin Spencer
    Nov 4, 2004
  2. JosephByrns

    Slow, then quick then slow

    JosephByrns, Jul 10, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    2,498
    codezilla94
    Nov 13, 2007
  3. Mufasa
    Replies:
    7
    Views:
    422
    Alexey Smirnov
    Sep 4, 2007
  4. Replies:
    0
    Views:
    303
  5. Replies:
    4
    Views:
    546
    cwdjrxyz
    Jan 17, 2006
Loading...

Share This Page