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. hexadecimal convertions and add on datagrid

hexadecimal convertions and add on datagrid

Scheduled Pinned Locked Moved C#
databasequestionannouncement
9 Posts 3 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.
  • M Offline
    M Offline
    Mohammad Dabaan
    wrote on last edited by
    #1

    hello all, am making a project that has a datagridview that will be filed from a SQL DB, 1) there si a field in the DB that has a data in hexadecimal format, so how i can fill it after converting it to string. 2) what is the process of allowing the user to add, delete and update on the datagridview directly?? sorry for the ones who see that i ask an easy questions :(( but they are not easy 4 all of ones as u see :->

    Thanks alot Hamody

    G 1 Reply Last reply
    0
    • M Mohammad Dabaan

      hello all, am making a project that has a datagridview that will be filed from a SQL DB, 1) there si a field in the DB that has a data in hexadecimal format, so how i can fill it after converting it to string. 2) what is the process of allowing the user to add, delete and update on the datagridview directly?? sorry for the ones who see that i ask an easy questions :(( but they are not easy 4 all of ones as u see :->

      Thanks alot Hamody

      G Offline
      G Offline
      gauthee
      wrote on last edited by
      #2

      hi, when u write the query to retrieve the data, convert the hexadecimal value to a string so that ur table will not have any column with hexadecimal values. you can use edit, update, cancel and do the required manipulations on the datagrid, write the required logic in few methods and assign these methods accordingly to the datagrid events!!!

      Gautham

      M 1 Reply Last reply
      0
      • G gauthee

        hi, when u write the query to retrieve the data, convert the hexadecimal value to a string so that ur table will not have any column with hexadecimal values. you can use edit, update, cancel and do the required manipulations on the datagrid, write the required logic in few methods and assign these methods accordingly to the datagrid events!!!

        Gautham

        M Offline
        M Offline
        Mohammad Dabaan
        wrote on last edited by
        #3

        thanks, but how i can convert from hexadecimal to string, io dont know the function to do this. have u an example on add, delete, update on the datagridview :confused:

        Thanks alot Hamody

        L G 2 Replies Last reply
        0
        • M Mohammad Dabaan

          thanks, but how i can convert from hexadecimal to string, io dont know the function to do this. have u an example on add, delete, update on the datagridview :confused:

          Thanks alot Hamody

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #4

          Hi, int.Parse(myString, NumberStyles.AllowHexSpecifier); will do it; I find the style name confusing, it means read-as-hex but does not allow the 0x specifier ! :)

          Luc Pattyn

          M 1 Reply Last reply
          0
          • M Mohammad Dabaan

            thanks, but how i can convert from hexadecimal to string, io dont know the function to do this. have u an example on add, delete, update on the datagridview :confused:

            Thanks alot Hamody

            G Offline
            G Offline
            gauthee
            wrote on last edited by
            #5

            datagrid examples:http://www.4guysfromrolla.com/webtech/122300-1.shtml give me a detailed explaination reg the hexadecimal prblm....

            Gautham

            M 1 Reply Last reply
            0
            • L Luc Pattyn

              Hi, int.Parse(myString, NumberStyles.AllowHexSpecifier); will do it; I find the style name confusing, it means read-as-hex but does not allow the 0x specifier ! :)

              Luc Pattyn

              M Offline
              M Offline
              Mohammad Dabaan
              wrote on last edited by
              #6

              i tried it as: string hhhh; hhhh=int.Parse("ffff", NumberStyles.AllowHexSpecifier).ToString(); MessageBox.Show(hhhh); use using System.Globalization; as name space but it hasnt convert the hex to string what can i do ???:sigh:

              Thanks alot Hamody

              L 1 Reply Last reply
              0
              • G gauthee

                datagrid examples:http://www.4guysfromrolla.com/webtech/122300-1.shtml give me a detailed explaination reg the hexadecimal prblm....

                Gautham

                M Offline
                M Offline
                Mohammad Dabaan
                wrote on last edited by
                #7

                ok thanks first,,, i mean that i have SQL database table which has a field containg hexadecimal data (arabic converted to hexadecimal) i want 2 show converted data on the datagridview ;P

                Thanks alot Hamody

                G 1 Reply Last reply
                0
                • M Mohammad Dabaan

                  i tried it as: string hhhh; hhhh=int.Parse("ffff", NumberStyles.AllowHexSpecifier).ToString(); MessageBox.Show(hhhh); use using System.Globalization; as name space but it hasnt convert the hex to string what can i do ???:sigh:

                  Thanks alot Hamody

                  L Offline
                  L Offline
                  Luc Pattyn
                  wrote on last edited by
                  #8

                  Your code seems right. This code snippet works for me:

                  	public override void Run(int arg) {
                  		hex("12");
                  		hex("1234");
                  		hex("1aBd");
                  		hex("FFFF");
                  		hex("ffff");
                  	}
                  
                  	public void hex(string s) {
                  		int i=int.Parse(s,NumberStyles.AllowHexSpecifier);
                  		log("hex "+s+" = decimal "+i);
                  	}
                  

                  It produces

                  hex 12 = decimal 18
                  hex 1234 = decimal 4660
                  hex 1aBd = decimal 6845
                  hex FFFF = decimal 65535
                  hex ffff = decimal 65535

                  so I expect your problem is elsewhere. :)

                  Luc Pattyn

                  1 Reply Last reply
                  0
                  • M Mohammad Dabaan

                    ok thanks first,,, i mean that i have SQL database table which has a field containg hexadecimal data (arabic converted to hexadecimal) i want 2 show converted data on the datagridview ;P

                    Thanks alot Hamody

                    G Offline
                    G Offline
                    gauthee
                    wrote on last edited by
                    #9

                    Check this link: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1161100&SiteID=1

                    Gautham

                    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