| | Submitted on: 11/28/2003 2:14:39 PM
By: Anti Social
Level: Intermediate User Rating: Unrated Compatibility:VB 6.0
Users have accessed this article 394 times. |
|
| | This code simply adds the ascii characters 0 to 255, their symbols, and their hex values to a listbox.
I made this to help me decode packets from hexidecimal to decimal when capturing a packet. This is not the greatest code, but it still works well enough to satisfy me. | |
|
Terms of Agreement:
By using this article, you agree to the following terms...
1) You may use
this article in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
2) You MAY NOT redistribute this article (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.
3) You may link to this article from another website, but ONLY if it is not wrapped in a frame.
4) You will abide by any additional copyright restrictions which the author may have placed in the article or article's description. |
Private Sub Form_Load()
Dim intASC As Integer, i As Integer, b As Integer
Dim strin As String
For intASC = 0 To 255
i = i + 1
a = a + 1
List1.AddItem "ASCII = " & i - 1 & " Character= " & (Chr(intASC)) & " Hex=" & strin
List1.AddItem " "
If a = 0 Then strin = "00"
If a = 1 Then strin = "01"
If a = 2 Then strin = "02"
If a = 3 Then strin = "03"
If a = 4 Then strin = "04"
If a = 5 Then strin = "05"
If a = 6 Then strin = "06"
If a = 7 Then strin = "07"
If a = 8 Then strin = "08"
If a = 9 Then strin = "09"
If a = 10 Then strin = "0A"
If a = 11 Then strin = "0B"
If a = 12 Then strin = "0C"
If a = 13 Then strin = "0D"
If a = 14 Then strin = "0E"
If a = 15 Then strin = "0F"
If a = 16 Then strin = "10"
If a = 17 Then strin = "11"
If a = 18 Then strin = "12"
If a = 19 Then strin = "13"
If a = 20 Then strin = "14"
If a = 21 Then strin = "15"
If a = 22 Then strin = "16"
If a = 23 Then strin = "17"
If a = 24 Then strin = "18"
If a = 25 Then strin = "19"
If a = 26 Then strin = "1A"
If a = 27 Then strin = "1B"
If a = 28 Then strin = "1C"
If a = 29 Then strin = "1D"
If a = 30 Then strin = "1E"
If a = 31 Then strin = "1F"
If a = 32 Then strin = "20"
If a = 33 Then strin = "21"
If a = 34 Then strin = "22"
If a = 35 Then strin = "23"
If a = 36 Then strin = "24"
If a = 37 Then strin = "25"
If a = 38 Then strin = "26"
If a = 39 Then strin = "27"
If a = 40 Then strin = "28"
If a = 41 Then strin = "29"
If a = 42 Then strin = "2A"
If a = 43 Then strin = "2B"
If a = 44 Then strin = "2C"
If a = 45 Then strin = "2D"
If a = 46 Then strin = "2E"
If a = 47 Then strin = "2F"
If a = 48 Then strin = "30"
If a = 49 Then strin = "31"
If a = 50 Then strin = "32"
If a = 51 Then strin = "33"
If a = 52 Then strin = "34"
If a = 53 Then strin = "35"
If a = 54 Then strin = "36"
If a = 55 Then strin = "37"
If a = 56 Then strin = "38"
If a = 57 Then strin = "39"
If a = 58 Then strin = "3A"
If a = 59 Then strin = "3B"
If a = 60 Then strin = "3C"
If a = 61 Then strin = "3D"
If a = 62 Then strin = "3E"
If a = 63 Then strin = "3F"
If a = 64 Then strin = "40"
If a = 65 Then strin = "41"
If a = 66 Then strin = "42"
If a = 67 Then strin = "43"
If a = 68 Then strin = "44"
If a = 69 Then strin = "45"
If a = 70 Then strin = "46"
If a = 71 Then strin = "47"
If a = 72 Then strin = "48"
If a = 73 Then strin = "49"
If a = 74 Then strin = "4A"
If a = 75 Then strin = "4B"
If a = 76 Then strin = "4C"
If a = 77 Then strin = "4D"
If a = 78 Then strin = "4E"
If a = 79 Then strin = "4F"
If a = 80 Then strin = "50"
If a = 81 Then strin = "51"
If a = 82 Then strin = "52"
If a = 83 Then strin = "53"
If a = 84 Then strin = "54"
If a = 85 Then strin = "55"
If a = 86 Then strin = "56"
If a = 87 Then strin = "57"
If a = 88 Then strin = "58"
If a = 89 Then strin = "59"
If a = 90 Then strin = "5A"
If a = 91 Then strin = "5B"
If a = 92 Then strin = "5C"
If a = 93 Then strin = "5D"
If a = 94 Then strin = "5E"
If a = 95 Then strin = "5F"
If a = 96 Then strin = "60"
If a = 97 Then strin = "61"
If a = 98 Then strin = "62"
If a = 99 Then strin = "63"
If a = 100 Then strin = "64"
If a = 101 Then strin = "65"
If a = 102 Then strin = "66"
If a = 103 Then strin = "67"
If a = 104 Then strin = "68"
If a = 105 Then strin = "69"
If a = 106 Then strin = "6A"
If a = 107 Then strin = "6B"
If a = 108 Then strin = "6C"
If a = 109 Then strin = "6D"
If a = 110 Then strin = "6E"
If a = 111 Then strin = "6F"
If a = 112 Then strin = "70"
If a = 113 Then strin = "71"
If a = 114 Then strin = "72"
If a = 115 Then strin = "73"
If a = 116 Then strin = "74"
If a = 117 Then strin = "75"
If a = 118 Then strin = "76"
If a = 119 Then strin = "77"
If a = 120 Then strin = "78"
If a = 121 Then strin = "79"
If a = 122 Then strin = "7A"
If a = 123 Then strin = "7B"
If a = 124 Then strin = "7C"
If a = 125 Then strin = "7D"
If a = 126 Then strin = "7E"
If a = 127 Then strin = "7F"
If a = 128 Then strin = "80"
If a = 129 Then strin = "81"
If a = 130 Then strin = "82"
If a = 131 Then strin = "83"
If a = 132 Then strin = "84"
If a = 133 Then strin = "85"
If a = 134 Then strin = "86"
If a = 135 Then strin = "87"
If a = 136 Then strin = "88"
If a = 137 Then strin = "89"
If a = 138 Then strin = "8A"
If a = 139 Then strin = "8B"
If a = 140 Then strin = "8C"
If a = 141 Then strin = "8D"
If a = 142 Then strin = "8E"
If a = 143 Then strin = "8F"
If a = 144 Then strin = "90"
If a = 145 Then strin = "91"
If a = 146 Then strin = "92"
If a = 147 Then strin = "93"
If a = 148 Then strin = "94"
If a = 149 Then strin = "95"
If a = 150 Then strin = "96"
If a = 151 Then strin = "97"
If a = 152 Then strin = "98"
If a = 153 Then strin = "99"
If a = 154 Then strin = "9A"
If a = 155 Then strin = "9B"
If a = 156 Then strin = "9C"
If a = 157 Then strin = "9D"
If a = 158 Then strin = "9E"
If a = 159 Then strin = "9F"
If a = 160 Then strin = "A0"
If a = 161 Then strin = "A1"
If a = 162 Then strin = "A2"
If a = 163 Then strin = "A3"
If a = 164 Then strin = "A4"
If a = 165 Then strin = "A5"
If a = 166 Then strin = "A6"
If a = 167 Then strin = "A7"
If a = 168 Then strin = "A8"
If a = 169 Then strin = "A9"
If a = 170 Then strin = "AA"
If a = 171 Then strin = "AB"
If a = 172 Then strin = "AC"
If a = 173 Then strin = "AD"
If a = 174 Then strin = "AE"
If a = 175 Then strin = "AF"
If a = 176 Then strin = "B0"
If a = 177 Then strin = "B1"
If a = 178 Then strin = "B2"
If a = 179 Then strin = "B3"
If a = 180 Then strin = "B4"
If a = 181 Then strin = "B5"
If a = 182 Then strin = "B6"
If a = 183 Then strin = "B7"
If a = 184 Then strin = "B8"
If a = 185 Then strin = "B9"
If a = 186 Then strin = "BA"
If a = 187 Then strin = "BB"
If a = 188 Then strin = "BC"
If a = 189 Then strin = "BD"
If a = 190 Then strin = "BE"
If a = 191 Then strin = "BF"
If a = 192 Then strin = "C0"
If a = 193 Then strin = "C1"
If a = 194 Then strin = "C2"
If a = 195 Then strin = "C3"
If a = 196 Then strin = "C4"
If a = 197 Then strin = "C5"
If a = 198 Then strin = "C6"
If a = 199 Then strin = "C7"
If a = 200 Then strin = "C8"
If a = 201 Then strin = "C9"
If a = 202 Then strin = "CA"
If a = 203 Then strin = "CB"
If a = 204 Then strin = "CC"
If a = 205 Then strin = "CD"
If a = 206 Then strin = "CE"
If a = 207 Then strin = "CF"
If a = 208 Then strin = "D0"
If a = 209 Then strin = "D1"
If a = 210 Then strin = "D2"
If a = 211 Then strin = "D3"
If a = 212 Then strin = "D4"
If a = 213 Then strin = "D5"
If a = 214 Then strin = "D6"
If a = 215 Then strin = "D7"
If a = 216 Then strin = "D8"
If a = 217 Then strin = "D9"
If a = 218 Then strin = "DA"
If a = 219 Then strin = "DB"
If a = 220 Then strin = "DC"
If a = 221 Then strin = "DD"
If a = 222 Then strin = "DE"
If a = 223 Then strin = "DF"
If a = 224 Then strin = "E0"
If a = 225 Then strin = "E1"
If a = 226 Then strin = "E2"
If a = 227 Then strin = "E3"
If a = 228 Then strin = "E4"
If a = 229 Then strin = "E5"
If a = 230 Then strin = "E6"
If a = 231 Then strin = "E7"
If a = 232 Then strin = "E8"
If a = 233 Then strin = "E9"
If a = 234 Then strin = "EA"
If a = 235 Then strin = "EB"
If a = 236 Then strin = "EC"
If a = 237 Then strin = "ED"
If a = 238 Then strin = "EE"
If a = 239 Then strin = "EF"
If a = 240 Then strin = "F0"
If a = 241 Then strin = "F1"
If a = 242 Then strin = "F2"
If a = 243 Then strin = "F3"
If a = 244 Then strin = "F4"
If a = 245 Then strin = "F5"
If a = 246 Then strin = "F6"
If a = 247 Then strin = "F7"
If a = 248 Then strin = "F8"
If a = 249 Then strin = "F9"
If a = 250 Then strin = "FA"
If a = 251 Then strin = "FB"
If a = 252 Then strin = "FC"
If a = 253 Then strin = "FD"
If a = 254 Then strin = "FE"
If a = 255 Then strin = "FF"
Next intASC
End Sub
| |
Other 5 submission(s) by this author
|
|
|
Report Bad Submission |
|
|
Your Vote! |
See Voting Log |
|
Other User Comments |
11/28/2003 2:46:16 PM:Coding Genius OMFG! LMAO!
Msgbox CLng(''
|
11/28/2003 2:47:10 PM:Coding Genius or Msgbox Hex$(DecVal) for the hex->dec
|
11/28/2003 2:47:45 PM:Coding Genius I can't believe you wrote 256 seperate
IF statements. lol. That's crazy sh1t.
|
11/28/2003 3:07:55 PM:Neophyte lmao. that's made my day :)
|
11/28/2003 5:49:54 PM: Perhaps you should aim higher (esp. for
intermediate). Try something like;
Dim
i%
For i% = 0 To 255
List1.AddItem
"ASCII = " & i% & " Character= " &
Chr$(CStr(i%)) & " Hex= " &
Hex$(i%)
Next
You'll only need a
conditional if you want it perfected.
|
11/28/2003 6:10:16 PM:KRYO_11 uhhhh...you know VB has a hex function
built in right? LOL....
Hex$('number')
|
11/28/2003 6:10:32 PM:KRYO_11 uhhhh...you know VB has a hex function
built in right?
Hex$('number')
|
11/28/2003 6:11:03 PM:KRYO_11 double posted...oops
|
11/30/2003 11:33:35 AM:Karim Try looking through VB's built in
functions - they save a lot of time!
|
|
Add Your Feedback! |
Note:Not only will your feedback be posted, but an email will be sent to the code's author in your name.
NOTICE: The author of this article has been kind enough to share it with you. If you have a criticism, please state it politely or it will be deleted.
For feedback not related to this particular article, please click here. |
|