Feb 10th, 2005, 11:24 PM
#1
Thread Starter
New Member
Printing the Ascii code of a string into a text box.
Hi all,
I need a code that will do as the title suggests, take a string, letter by letter, and print out the ascii code to a text box of each letter. I have not used Visual Basic for quite some time, and remember learning how to do this, but forgot how.
Thanks in advance.
Chris
Feb 10th, 2005, 11:44 PM
#2
Re: Printing the Ascii code of a string into a text box.
Add text1 and txtout and a command button:
VB Code:
Option Explicit
Dim x As Integer
Dim z As Integer
Private Sub Command1_Click()
x = Len(Text1.Text)
For z = 1 To x
txtout.Text = txtout.Text & Asc(Mid(Text1.Text, z, 1)) & " "
Next z
End Sub
Private Sub Form_Load()
Text1.Text = ""
txtout.Text = ""
End Sub
Attached Images
Feb 10th, 2005, 11:44 PM
#3
Re: Printing the Ascii code of a string into a text box.
VB Code:
Option Explicit
Private Sub Command1_Click()
Dim i As Integer
If Text1.Text = vbNullString Then Exit Sub
For i = 1 To Len(Text1.Text)
Text2.Text = Text2.Text & Asc(Mid$(Text1.Text, i, 1)) & ";"
Next
End Sub
VB/Office Guru™ (AKA: Gangsta Yoda ™ ® )
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
Feb 10th, 2005, 11:46 PM
#4
Re: Printing the Ascii code of a string into a text box.
I almost decided to use dynamic textboxes for the answers, but changed my mind. I must have worked for a good 5 minutes. Hope you enjoy it
Feb 10th, 2005, 11:47 PM
#5
Re: Printing the Ascii code of a string into a text box.
To the minute!
VB/Office Guru™ (AKA: Gangsta Yoda ™ ® )
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
Feb 10th, 2005, 11:56 PM
#6
Re: Printing the Ascii code of a string into a text box.
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