hexadecimal convertions and add on datagrid
-
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
-
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
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
-
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
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
-
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
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
-
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
datagrid examples:http://www.4guysfromrolla.com/webtech/122300-1.shtml give me a detailed explaination reg the hexadecimal prblm....
Gautham
-
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
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
-
datagrid examples:http://www.4guysfromrolla.com/webtech/122300-1.shtml give me a detailed explaination reg the hexadecimal prblm....
Gautham
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
-
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
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 65535so I expect your problem is elsewhere. :)
Luc Pattyn
-
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
Check this link: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1161100&SiteID=1
Gautham