Results 1 to 4 of 4

Thread: [RESOLVED] [2005] dim c as char; if c = " then

  1. #1

    Thread Starter
    Hyperactive Member ZaNi's Avatar
    Join Date
    Jun 2006
    Location
    Australia
    Posts
    360

    Resolved [RESOLVED] [2005] dim c as char; if c = " then

    I need to know how to compare a character to " in vb.net. I know this is a simple question, but I can't think of how to ask it to a computer (ie search google or the forums).

    Basically I have a character that I grab from a string and I need to check if it is a quote, because I need to allow "," within a quote, but not outside a quote.

    Thanks in advance.
    * Don't limit yourself to sanity
    * I'd rather be optimistic and naive than pessimistic and right
    * Ask good questions, get good answers.

    My Codebank submissions:
    How to write one rountine to handle many events
    Accessing and Using variables across multiple forms
    Printing/Previewing a form or control

    Links I've "borrowed" from other people:
    vbdotnetboy - Awesome site for tips

  2. #2
    PowerPoster
    Join Date
    Aug 2005
    Location
    College Station, TX
    Posts
    4,521

    Re: [2005] dim c as char; if c = " then

    I think its a little trivial, but this should do it...
    VB Code:
    1. Dim MyChar As Char = """"c ' 1 double quote character
    2.         MessageBox.Show(MyChar) 'shows 1 double quote
    3.         If MyChar = """" Then
    4.             MessageBox.Show("Its it!")
    5.         End If
    2 Double quotes inside of the quotes would parse into one....

  3. #3
    PowerPoster VBDT's Avatar
    Join Date
    Sep 2005
    Location
    CA - USA
    Posts
    2,922

    Re: [2005] dim c as char; if c = " then

    try this
    VB Code:
    1. If Asc(ch) = 34 Then '34 is the ASCII value of '"'
    2.     'Do what ever
    3. End If

  4. #4

    Thread Starter
    Hyperactive Member ZaNi's Avatar
    Join Date
    Jun 2006
    Location
    Australia
    Posts
    360

    Re: [2005] dim c as char; if c = " then

    Thanks.
    * Don't limit yourself to sanity
    * I'd rather be optimistic and naive than pessimistic and right
    * Ask good questions, get good answers.

    My Codebank submissions:
    How to write one rountine to handle many events
    Accessing and Using variables across multiple forms
    Printing/Previewing a form or control

    Links I've "borrowed" from other people:
    vbdotnetboy - Awesome site for tips

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width