Solved

removing unwanted data from a string

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
consolidate or create a new vba code for performing tasks 5 66
Saving history changes to sub form 4 42
Hide vba in gp 7 93
MsgBox 4 59
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
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…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

786 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