Solved

removing unwanted data from a string

Posted on 2004-09-01
4
160 Views
Last Modified: 2010-05-02
I am using the following code to read some information from the registry:

nbufferdata = Space(256)
RegOpenKey LOCALMACHINE, MainKey, nBufferKey
RegOpenKey nBufferKey, SubKey, nBufferSubKey
RegQueryValueEx nBufferSubKey, Item, 0, REG_SZ, nbufferdata, Len(nbufferdata)


it works fine, but nbufferdata contains a lot of characters that are not part of the information read from the registry.

I know there's a simple procuedure to remove these but cant think of what it is, can anyone help??

Cheers,

`Andy
0
Comment
Question by:xizor
4 Comments
 
LVL 8

Accepted Solution

by:
mladenovicz earned 50 total points
ID: 11950052
nbufferdata= Left$(nbufferdata, InStr(1, nbufferdata, Chr$(0)) - 1)
0
 
LVL 18

Expert Comment

by:JR2003
ID: 11950065
nbufferdata = Left$(nbufferdata , InStr(1, nbufferdata, Chr$(0)) - 1)
0
 
LVL 2

Expert Comment

by:craigewens
ID: 11950084
Replace(expression, find, replacewith[, start[, count[, compare]]])
0
 
LVL 2

Author Comment

by:xizor
ID: 11950103
Thanks!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now