Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How can I look for ASCII values in my DataGrid

How can I look for ASCII values in my DataGrid

Scheduled Pinned Locked Moved C#
helpquestion
8 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    Walaza
    wrote on last edited by
    #1

    Hi, I have a loop that loops through the data in my datagrid and checks for empty columns and reports them as errors. I need code to also check for ASCII values/data and report it.The code below is within the loop and checks for empty columns: if (dgOutput.Rows[rowNum].Cells[colm].Value.ToString() == "") error_per_row = error_per_row +"Error: Invalid characters on " + field_name; Can anyone help to check for ASCII values.

    Mvelo Walaza Developer Telkom SA

    C R 2 Replies Last reply
    0
    • W Walaza

      Hi, I have a loop that loops through the data in my datagrid and checks for empty columns and reports them as errors. I need code to also check for ASCII values/data and report it.The code below is within the loop and checks for empty columns: if (dgOutput.Rows[rowNum].Cells[colm].Value.ToString() == "") error_per_row = error_per_row +"Error: Invalid characters on " + field_name; Can anyone help to check for ASCII values.

      Mvelo Walaza Developer Telkom SA

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      What do you mean by ASCII values ? All non blank strings are arguably ASCII values. Why not parse your data source and any input instead of doing this all the time ?

      Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

      V W 2 Replies Last reply
      0
      • C Christian Graus

        What do you mean by ASCII values ? All non blank strings are arguably ASCII values. Why not parse your data source and any input instead of doing this all the time ?

        Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

        V Offline
        V Offline
        Vikram A Punathambekar
        wrote on last edited by
        #3

        Christian Graus wrote:

        All non blank strings are arguably ASCII values.

        Not quite - if the language in use is not written in the Roman script (Cyrillic, Indian scripts, CJK, etc) he may be right in considering ASCII values invalid.

        Cheers, Vikram.


        The hands that help are holier than the lips that pray.

        1 Reply Last reply
        0
        • W Walaza

          Hi, I have a loop that loops through the data in my datagrid and checks for empty columns and reports them as errors. I need code to also check for ASCII values/data and report it.The code below is within the loop and checks for empty columns: if (dgOutput.Rows[rowNum].Cells[colm].Value.ToString() == "") error_per_row = error_per_row +"Error: Invalid characters on " + field_name; Can anyone help to check for ASCII values.

          Mvelo Walaza Developer Telkom SA

          R Offline
          R Offline
          Ravenet
          wrote on last edited by
          #4

          Hey There is lot of way for that, get string and pass to char, then check ur ASCII is found in the grid cell value. more info: please search in web.

          Cheers,Earn and Enjoy RRave MCTS,MCPD http://ravesoft.blogspot.com

          1 Reply Last reply
          0
          • C Christian Graus

            What do you mean by ASCII values ? All non blank strings are arguably ASCII values. Why not parse your data source and any input instead of doing this all the time ?

            Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

            W Offline
            W Offline
            Walaza
            wrote on last edited by
            #5

            I'm trying to say that, if the datagrid rows contains any ASCII values/data it should display an error (add it to error_per_row). I would like code to check if any ASCII data exists in the row.

            Mvelo Walaza Developer Telkom SA

            C 1 Reply Last reply
            0
            • W Walaza

              I'm trying to say that, if the datagrid rows contains any ASCII values/data it should display an error (add it to error_per_row). I would like code to check if any ASCII data exists in the row.

              Mvelo Walaza Developer Telkom SA

              C Offline
              C Offline
              Christian Graus
              wrote on last edited by
              #6

              OK - so you want to throw an error no matter what ? If the string is empty, or if it's not ? Or, can you tell me what you mean by ASCII ? Whatever you mean, and it's far from clear, you can do it with a regex.

              Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

              W 1 Reply Last reply
              0
              • C Christian Graus

                OK - so you want to throw an error no matter what ? If the string is empty, or if it's not ? Or, can you tell me what you mean by ASCII ? Whatever you mean, and it's far from clear, you can do it with a regex.

                Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

                W Offline
                W Offline
                Walaza
                wrote on last edited by
                #7

                I'm trying to say: if while looping through the data in the datagrid I come across data that is not normal alphabets (written in ASCII code), add "Invalid characters" to the 'error_per_row' vaiable.

                Mvelo Walaza Developer Telkom SA

                C 1 Reply Last reply
                0
                • W Walaza

                  I'm trying to say: if while looping through the data in the datagrid I come across data that is not normal alphabets (written in ASCII code), add "Invalid characters" to the 'error_per_row' vaiable.

                  Mvelo Walaza Developer Telkom SA

                  C Offline
                  C Offline
                  Christian Graus
                  wrote on last edited by
                  #8

                  OK, well you failed utterly to say that. You can do that with a regex, easy enough. If you don't know how to use regular expressions, I'd recomend downloading the program 'expresso'

                  Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups