473,388 Members | 1,230 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Convert ASCII to Character in VB6.0 (By Hisham)

hi i had array whicle nearly 2 lakhs ascii character. Now i converting to character by following code

for i= 1 to ubound(AsciiArray) 'ubound size=2,00,000
str= str + Asc(AsciiArray(i))
next i

but it takes more than 10 minutes so i want to code which minimize this the time. could anyone help me.

with regards

Hisham
May 9 '08 #1
1 7317
QVeen72
1,445 Expert 1GB
Hi,

Use Microsoft Script Control

Add Microsoft Script Control to your form and name it as mscr.

Check this code:

Expand|Select|Wrap|Line Numbers
  1. Dim sSQL As String
  2. Dim NewStr As String
  3. '
  4. sSQL = Join(AsciiArray, ") & Chr(")
  5. sSQL = "Chr(" & sSQL
  6. sSQL = Left(sSQL, Len(sSQL) - 6)
  7. '
  8. mscr.AddCode _
  9.     "Function MyFunction()" & vbCrLf & _
  10.     "    MyFunction = " & sSQL & vbCrLf _
  11.     & _
  12.     "End Function"
  13. NewStr = mscr.Eval("MyFunction()")
  14.  
  15.  
This works very fast..
Logic here is :
Join all the Ascii Numbers with Chr( ) and Concatenate
and Evaluate the End result with the Script Control.
This worked fine here for 1000 records...
For 2lakh records , if you are getting error, Split the Array into smaller arrays of say 10000 items. find the result of each and Concatenate the end result...
Also Note : AsciiArray should be declared as Datatype =String..(or else JOIN function will err)


Regards
Veena
May 9 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: David Williams | last post by:
Hi all, i have been able to convert an ASCII character to an INT however im lost as to how to change them back. Cant find anything on the net (though im probably looking in the wrong places!)....
2
by: jt | last post by:
Looking for an example how to convert and CString to an ASCII character string. Any examples on how to do this? Thank you, jt
37
by: chandy | last post by:
Hi, I have an Html document that declares that it uses the utf-8 character set. As this document is editable via a web interface I need to make sure than high-ascii characters that may be...
3
by: Director - Minvent | last post by:
Hi, I am reading from a serial port from a device which sends over an ascii character. It uses the full extended 256 character set and therefore has non-printing characters too. So what i want...
18
by: Marcel Saucier | last post by:
Hello, I want to use the above characters codes chart but I dont know how to set the typeface (documentation: The characters that appear in Windows above 127 depend on the selected typeface). ...
16
by: akarui.tomodachi | last post by:
What is the most easiest way to convert an integer value to ASCII character format ? I tried with sprintf(). It works. Is there any other way to do that ? Objective:: I like to convert an...
6
by: bruce | last post by:
hi... i'm running into a problem where i'm seeing non-ascii chars in the parsing i'm doing. in looking through various docs, i can't find functions to remove/restrict strings to valid ascii...
6
by: davetelling | last post by:
I am a total newbie, trying to slog through the Visual C# Express application. I need to be able to convert a single ASCII character (can be anything from 0 to 255) to an int for use in other...
4
by: meendar | last post by:
Hi, I am having a character pointer which contains ascii values. i just want to convert all these ascii values to respective characters and again store it in another character pointer. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.