Solved

removing unwanted data from a string

Posted on 2004-09-01
4
163 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

821 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