|
-
Jan 15th, 2006, 09:24 AM
#1
Thread Starter
Junior Member
ascii in order
sigh yet another dead end of searching....I can't even begin to start this one, I am stumped....SO I came here...
what I am looking for is....
a code that will change the letter in a text box +1 (including A - Z 'upper and lower case' ,numbers/charaters ) pretty much anything that is "normally used for typing" I want it to go off in order.
after it gets to the last one in the order it goes back to the first keeps it in the first spot and does the same loop with the seccond spot, then changes the first one to the seccond in the loop, etc....
example:
A
B
.(skip ahead)
.(skip ahead)
Z
AA
AB
.(skip ahead)
.(skip ahead)
BA
BB
if you don't get that then I can explain it better.
I only need the basic code and idea of how to do it, not the entire thing, I know it will be long...maybe lol.
-
Jan 15th, 2006, 09:44 AM
#2
Re: ascii in order
password cracker ?
you know theres 255 characters, so to go past a set of about 8+ long will take you a long time.
Last edited by Jmacp; Jan 15th, 2006 at 09:49 AM.
-
Jan 15th, 2006, 09:51 AM
#3
Thread Starter
Junior Member
Re: ascii in order
no, I was just messing with text and etc, and I wanted to make a list of letters in order maybe mess with encoding, ASCII is a low point for me...I can never get anything to work with letters (not text1.text= either) but stuff like finding the letter and changing it up once, etc etc...I want to see code, this will be an example of every ASCII think I will need......I don't get that password cracking stuff......
-
Jan 15th, 2006, 09:59 AM
#4
Re: ascii in order
To go 'up' a character, you need to convert the character to its ASCII equivalent (using the Asc function), add 1 to this number, then convert that number to the character equivalent to that ASCII code (using the Chr function).
Assuming this is only for one character, the following will work:
VB Code:
Dim iInitialAsciiCode as Integer
Dim iNextAsciiCode as Integer
iInitialAsciiCode = Asc(Text1.Text)
iNextAsciiCode = iInitialAsciiCode + 1
Text1.Text = Chr(iNextAsciiCode)
..which can also be written as:
VB Code:
Text1.Text = Chr(Asc(Text1.Text) + 1)
Note tho that this will get errors if you try to go past the ASCII value of 255, and will also go through all characters, not just the ones normally used - to do that you will first need to find out which codes are normally used, for that you will need to find an ASCII character table.
-
Jan 16th, 2006, 02:47 AM
#5
-
Feb 19th, 2009, 01:02 PM
#6
Lively Member
Re: ascii in order
I do believe these are correct.
Key Codes
Constant Value Description
vbKeyLButton 1 Left mouse button
vbKeyRButton 2 Right mouse button
vbKeyCancel 3 CANCEL key
vbKeyMButton 4 Middle mouse button
vbKeyBack 8 BACKSPACE key
vbKeyTab 9 TAB key
vbKeyClear 12 CLEAR key
vbKeyReturn 13 ENTER key
vbKeyShift 16 SHIFT key
vbKeyControl 17 CTRL key
vbKeyMenu 18 MENU key
vbKeyPause 19 PAUSE key
vbKeyCapital 20 CAPS LOCK key
vbKeyEscape 27 ESC key
vbKeySpace 32 SPACEBAR key
vbKeyPageUp 33 PAGE UP key
vbKeyPageDown 34 PAGE DOWN key
vbKeyEnd 35 END key
vbKeyHome 36 HOME key
vbKeyLeft 37 LEFT ARROW key
vbKeyUp 38 UP ARROW key
vbKeyRight 39 RIGHT ARROW key
vbKeyDown 40 DOWN ARROW key
vbKeySelect 41 SELECT key
vbKeyPrint 42 PRINT SCREEN key
vbKeyExecute 43 EXECUTE key
vbKeySnapshot 44 SNAPSHOT key
vbKeyInsert 45 INS key
vbKeyDelete 46 DEL key
vbKeyHelp 47 HELP key
vbKeyNumlock 144 NUM LOCK key
KeyA Through KeyZ Are the Same as Their ASCII Equivalents: 'A' Through 'Z'
Constant Value Description
vbKeyA 65 A key
vbKeyB 66 B key
vbKeyC 67 C key
vbKeyD 68 D key
vbKeyE 69 E key
vbKeyF 70 F key
vbKeyG 71 G key
vbKeyH 72 H key
vbKeyI 73 I key
vbKeyJ 74 J key
vbKeyK 75 K key
vbKeyL 76 L key
vbKeyM 77 M key
vbKeyN 78 N key
vbKeyO 79 O key
vbKeyP 80 P key
vbKeyQ 81 Q key
vbKeyR 82 R key
vbKeyS 83 S key
vbKeyT 84 T key
vbKeyU 85 U key
vbKeyV 86 V key
vbKeyW 87 W key
vbKeyX 88 X key
vbKeyY 89 Y key
vbKeyZ 90 Z key
Key0 Through Key9 Are the Same as Their ASCII Equivalents: '0' Through '9
Constant Value Description
vbKey0 48 0 key
vbKey1 49 1 key
vbKey2 50 2 key
vbKey3 51 3 key
vbKey4 52 4 key
vbKey5 53 5 key
vbKey6 54 6 key
vbKey7 55 7 key
vbKey8 56 8 key
vbKey9 57 9 key
Keys on the Numeric Keypad
Constant Value Description
vbKeyNumpad0 96 0 key
vbKeyNumpad1 97 1 key
vbKeyNumpad2 98 2 key
vbKeyNumpad3 99 3 key
vbKeyNumpad4 100 4 key
vbKeyNumpad5 101 5 key
vbKeyNumpad6 102 6 key
vbKeyNumpad7 103 7 key
vbKeyNumpad8 104 8 key
vbKeyNumpad9 105 9 key
vbKeyMultiply 106 MULTIPLICATION SIGN (*) key
vbKeyAdd 107 PLUS SIGN (+) key
vbKeySeparator 108 ENTER (keypad) key
vbKeySubtract 109 MINUS SIGN (-) key
vbKeyDecimal 110 DECIMAL POINT(.) key
vbKeyDivide 111 DIVISION SIGN (/) key
Function Keys
Constant Value Description
vbKeyF1 112 F1 key
vbKeyF2 113 F2 key
vbKeyF3 114 F3 key
vbKeyF4 115 F4 key
vbKeyF5 116 F5 key
vbKeyF6 117 F6 key
vbKeyF7 118 F7 key
vbKeyF8 119 F8 key
vbKeyF9 120 F9 key
vbKeyF10 121 F10 key
vbKeyF11 122 F11 key
vbKeyF12 123 F12 key
vbKeyF13 124 F13 key
vbKeyF14 125 F14 key
vbKeyF15 126 F15 key
vbKeyF16 127 F16 key
"What is a hackers worst nightmare you may ask? Vista! Not that its hard to bypass its just that it gives you stupid annoying errors!"

-
Feb 19th, 2009, 01:13 PM
#7
Re: ascii in order
No, those are KeyCodes rather than ASCII codes - there are differences.
Also, this thread is over 3 years old, so I really hope the OP isn't still trying to sort it out - and that they (and the other people who subscribed to this thread) aren't too annoyed at getting notification of your post.
-
Feb 19th, 2009, 02:02 PM
#8
Re: ascii in order
 Originally Posted by [email protected]
sigh yet another dead end of searching....I can't even begin to start this one, I am stumped....SO I came here...
what I am looking for is....
a code that will change the letter in a text box +1 (including A - Z 'upper and lower case' ,numbers/charaters ) pretty much anything that is "normally used for typing" I want it to go off in order.
after it gets to the last one in the order it goes back to the first keeps it in the first spot and does the same loop with the seccond spot, then changes the first one to the seccond in the loop, etc....
example:
A
B
.(skip ahead)
.(skip ahead)
Z
AA
AB
.(skip ahead)
.(skip ahead)
BA
BB
if you don't get that then I can explain it better.
I only need the basic code and idea of how to do it, not the entire thing, I know it will be long...maybe lol.
The most usual characters that are used in typing start from 32 to 255. So you need to loop from there.
Something like this:
vb.net Code:
For i = 32 to 255
Print Chr(i)
For j = 32 to 255
Print Chr(i) & Chr(j)
For k = 32 to 255
Print Chr(i) & Chr(j) & Chr(k)
'... More FORs follow here...
Print Chr(i) & Chr(j) & Chr(k) & ....
'....
Next
Next
Next
This is not so practical to put 255 or so loops there. So what we do is create one function and call it over and over again from within itself (recursion).
vb.net Code:
Private codesList As List(Of String) 'To hold our generated values
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'All codes it too time consuming. We take only A to E for example here
GenerateCodes("A", "E")
End Sub
Private Sub GenerateCodes(ByVal startChar As Char, ByVal endChar As Char)
'initialize and empty list where we will store the codes
codesList = New List(Of String)
'Get the codes
GetCodes("", Asc(startChar), Asc(endChar))
'Now we have all the codes we want. So let's display it in our debug window
For Each s As String In codesList
Debug.Print(s)
Next
End Sub
'Recursive function
Private Sub GetCodes(ByVal code As String, ByVal startIndex As Integer, ByVal endIndex As Integer)
For i As Integer = startIndex To endIndex
Dim newCode As String = code & Chr(i)
codesList.Add(newCode)
GetCodes(newCode, startIndex, i - 1)
GetCodes(newCode, i + 1, endIndex)
Next
End Sub
-
Feb 19th, 2009, 02:04 PM
#9
Re: ascii in order
 Originally Posted by si_the_geek
No, those are KeyCodes rather than ASCII codes - there are differences.
Also, this thread is over 3 years old, so I really hope the OP isn't still trying to sort it out - and that they (and the other people who subscribed to this thread) aren't too annoyed at getting notification of your post.
Ohhhh...
Didn't notice this.
-
Feb 19th, 2009, 09:04 PM
#10
Fanatic Member
Re: ascii in order
1 form 1 textbox
Code:
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub Form_Load()
Dim i As Long, x As Long, y As Long
Me.Show
For i = 0 To 2147483647
x = i
Text1 = ""
Do
y = x Mod 27
If y = 0 Then y = 1
Text1 = Chr(y + 64) & Text1
x = Int(x / 27)
Loop While x > 0
Me.Refresh
DoEvents
Sleep 100
Next
End Sub
Private Sub Form_Unload(Cancel As Integer)
End
End Sub
I put a delay in it so you can examine the progress.
-
Feb 20th, 2009, 05:25 AM
#11
Re: ascii in order
Need Ascii table : check the link in my signature
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Feb 20th, 2009, 07:09 AM
#12
Re: ascii in order
@Pradeep, this is VB6 forum, not VB.Net. Your code should not post here.
I think the OP wants to have a listing of strings in order like column-headers in Excel.
In code below, change 65, 89 and 90 for a wider range if required.
A different approach need to be used for a non-contigurous character range.
Code:
Option Explicit
Function NextStr(Str1 As String) As String
Dim a As Byte, n As Long
n = Len(Str1)
If n Then
a = Asc(Right$(Str1, 1))
Select Case a
Case 65 To 89 '-- "A" to "Y"
NextStr = Left$(Str1, n - 1) & Chr$(a + 1)
Case 90 '-- "Z"
NextStr = NextStr(Left$(Str1, n - 1)) & "A" '-- recursive call
Case Else
MsgBox "Invalid character in input string: " & Str1
End Select
Else
NextStr = "A"
End If
End Function
Sub GenerateStr()
Dim i As Long, Str1 As String
For i = 1 To 1000
Str1 = NextStr(Str1)
Debug.Print Str1; " ";
If i Mod 20 = 0 Then Debug.Print '-- break line
Next
End Sub
-
Feb 20th, 2009, 09:11 AM
#13
Re: ascii in order
I think that's enough now folks - the OP has not replied for over 3 years, so I would be amazed if your replies are helping them at all.
As my warning didn't stop total necromancy, I'm closing the thread.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|