Adding Strings To Registry
ok well im an idiot and need someone with a brain to help. Im trying to store strings in the registry's Value area but keep getting Unicode instead of normal characters? here's the code:
'This program needs 3 buttons
Code: Const REG_SZ = 1 ' Unicode nul terminated string Const REG_BINARY = 3 ' Free form binary Const HKEY_CURRENT_USER = &H80000001 Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long Private Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" _ (ByVal hKey As Long, _ ByVal lpSubKey As String, _ phkResult As Long) As Long Private Declare Function RegDeleteValue Lib "advapi32.dll" Alias "RegDeleteValueA" _ (ByVal hKey As Long, _ ByVal lpValueName As String) As Long Private Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" _ (ByVal hKey As Long, _ ByVal lpSubKey As String, _ phkResult As Long) As Long Private Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" _ (ByVal hKey As Long, _ ByVal lpValueName As String, _ ByVal lpReserved As Long, _ lpType As Long, _ lpData As Any, _ lpcbData As Long) As Long Private Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" _ (ByVal hKey As Long, _ ByVal lpValueName As String, _ ByVal Reserved As Long, _ ByVal dwType As Long, _ lpData As Any, _ ByVal cbData As Long) As Long Function RegQueryStringValue(ByVal hKey As Long, ByVal strValueName As String) As String Dim lResult As Long, lValueType As Long, strBuf As String, lDataBufSize As Long 'retrieve nformation about the key lResult = RegQueryValueEx(hKey, strValueName, 0, lValueType, ByVal 0, lDataBufSize) If lResult = 0 Then If lValueType = REG_SZ Then 'Create a buffer strBuf = String(lDataBufSize, Chr$(0)) 'retrieve the key's content lResult = RegQueryValueEx(hKey, strValueName, 0, 0, ByVal strBuf, lDataBufSize) If lResult = 0 Then 'Remove the unnecessary chr$(0)'s RegQueryStringValue = Left$(strBuf, InStr(1, strBuf, Chr$(0)) - 1) End If ElseIf lValueType = REG_BINARY Then Dim strData As Integer 'retrieve the key's value lResult = RegQueryValueEx(hKey, strValueName, 0, 0, strData, lDataBufSize) If lResult = 0 Then RegQueryStringValue = strData End If End If End If End Function Function GetString(hKey As Long, strPath As String, strValue As String) Dim Ret 'Open the key RegOpenKey hKey, strPath, Ret 'Get the key's content GetString = RegQueryStringValue(Ret, strValue) 'Close the key RegCloseKey Ret End Function Sub SaveString(hKey As Long, strPath As String, strValue As String, strData As String) Dim Ret 'Create a new key RegCreateKey hKey, strPath, Ret 'Save a string to the key RegSetValueEx Ret, strValue, 0, REG_SZ, ByVal strData, Len(strData) 'close the key RegCloseKey Ret End Sub Sub SaveStringLong(hKey As Long, strPath As String, strValue As String, strData As String) Dim Ret 'Create a new key RegCreateKey hKey, strPath, Ret 'Set the key's value RegSetValueEx Ret, strValue, 0, 1, CByte(strData), 4 'close the key RegCloseKey Ret End Sub Sub DelSetting(hKey As Long, strPath As String, strValue As String) Dim Ret 'Create a new key RegCreateKey hKey, strPath, Ret 'Delete the key's value RegDeleteValue Ret, strValue 'close the key RegCloseKey Ret End Sub Private Sub Command1_Click() Dim strString As String 'Ask for a value strString = InputBox("Please enter a value between 0 and 255 to be saved as a binary value in the registry.", App.Title) If strString = "" Or Val(strString) > 255 Or Val(strString) < 0 Then MsgBox "Invalid value entered ...", vbExclamation + vbOKOnly, App.Title Exit Sub End If 'Save the value to the registry SaveStringLong HKEY_CURRENT_USER, "KPD-Team", "BinaryValue", CByte(strString) End Sub Private Sub Command2_Click() 'Get a string from the registry Ret = GetString(HKEY_CURRENT_USER, "KPD-Team", "BinaryValue") If Ret = "" Then MsgBox "No value found !", vbExclamation + vbOKOnly, App.Title: Exit Sub MsgBox "The value is " + Ret, vbOKOnly + vbInformation, App.Title End Sub Private Sub Command3_Click() 'Delete the setting from the registry DelSetting HKEY_CURRENT_USER, "KPD-Team", "BinaryValue" MsgBox "The value was deleted ...", vbInformation + vbOKOnly, App.Title End Sub Private Sub Form_Load() 'KPD-Team 1998 'URL: [url]http://www.allapi.net/[/url] 'E-Mail: [email]KPDTeam@Allapi.net[/email] Command1.Caption = "Set Value" Command2.Caption = "Get Value" Command3.Caption = "Delete Value" End Sub
Is there a way of sending strings, of normal ASNI, to the "Data" area of a registry key? If the above code doesnt work here is a link to where I got the code. It's from Allapi.net
http://www.allapi.net/apilist/RegCreateKey.shtml#
Ex: I want to store a string like this "Cats taste like chicken" in the Data section og the registry. Any ideas?
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Registry Strings..?
I am killing some time by making a smallish little prog to assist me in cleaning my recent file list in VB6. Well, it delete's values fine. But, I also go threw and back up all the remaning value's in an array and then clear the whole file list so that I can re-enter the list in the proper number order. This works too, except the file paths end up being wrecked into some wierd ascii mess. Bellow is all the code for the app.
There are 2 command buttons and two list boxes
1st Command Button: cmdDel
2nd Command Button: cmdCncl
1st ListBox: lstRF_Num
2nd ListBox: lstRF
you can make the form and paste this code in or just look it over.....
Code:
Option Explicit
'For contacting information see other module
Private Const HKEY_CLASSES_ROOT = &H80000000
Private Const HKEY_CURRENT_USER = &H80000001
Private Const HKEY_LOCAL_MACHINE = &H80000002
Private Const HKEY_USERS = &H80000003
Private Const HKEY_PERFORMANCE_DATA = &H80000004
Private Const HKEY_CURRENT_CONFIG = &H80000005
Private Const HKEY_DYN_DATA = &H80000006
Private Const REG_SZ = 1 ' Unicode nul terminated string
Private Const REG_BINARY = 3 ' Free form binary
Private Const REG_DWORD = 4 ' 32-bit number
Private Const REG_NONE = 0
Private Const ERROR_SUCCESS = 0&
Private Const KEY_ALL_ACCESS = &HF003F
Private Const KEY_CREATE_LINK = &H20
Private Const KEY_CREATE_SUB_KEY = &H4
Private Const KEY_ENUMERATE_SUB_KEYS = &H8
Private Const KEY_EXECUTE = &H20019
Private Const KEY_NOTIFY = &H10
Private Const KEY_QUERY_VALUE = &H1
Private Const KEY_READ = &H20019
Private Const KEY_SET_VALUE = &H2
Private Const KEY_WRITE = &H20006
Private Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Private Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias "RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, phkResult As Long) As Long
Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
Private Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Private Declare Function RegCreateKeyEx Lib "advapi32.dll" Alias "RegCreateKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal Reserved As Long, ByVal lpClass As String, ByVal dwOptions As Long, ByVal samDesired As Long, lpSecurityAttributes As SECURITY_ATTRIBUTES, phkResult As Long, lpdwDisposition As Long) As Long
Private Declare Function RegDeleteKey Lib "advapi32.dll" Alias "RegDeleteKeyA" (ByVal hKey As Long, ByVal lpSubKey As String) As Long
Private Declare Function RegDeleteValue Lib "advapi32.dll" Alias "RegDeleteValueA" (ByVal hKey As Long, ByVal lpValueName As String) As Long
'--------------------------------------------------
Private Declare Function RegEnumKey Lib "advapi32.dll" Alias "RegEnumKeyA" (ByVal hKey As Long, ByVal dwIndex As Long, ByVal lpName As String, ByVal cbName As Long) As Long
Private Declare Function RegEnumKeyEx Lib "advapi32.dll" Alias "RegEnumKeyExA" (ByVal hKey As Long, ByVal dwIndex As Long, ByVal lpName As String, lpcbName As Long, lpReserved As Long, ByVal lpClass As String, lpcbClass As Long, lpftLastWriteTime As FILETIME) As Long
Private Declare Function RegEnumValue Lib "advapi32.dll" Alias "RegEnumValueA" (ByVal hKey As Long, ByVal dwIndex As Long, ByVal lpValueName As String, lpcbValueName As Long, ByVal lpReserved As Long, lpType As Long, lpData As Byte, lpcbData As Long) As Long
'--------------------------------------------------
Private Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, lpData As Any, lpcbData As Long) As Long
Private Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long
'--------------------------------------------------
Private Declare Sub CopyMemory Lib "kernel32.dll" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
Private Type FILETIME
dwLowDateTime As Long
dwHighDateTime As Long
End Type
Private Type SECURITY_ATTRIBUTES
nLength As Long
lpSecurityDescriptor As Long
bInheritHandle As Boolean
End Type
Private Sub DeleteValue(ByVal hKey As Long, ByVal strPath As String, ByVal strValue As String)
Dim hCurKey As Long
Dim lRegResult As Long
lRegResult = RegOpenKey(hKey, strPath, hCurKey)
lRegResult = RegDeleteValue(hCurKey, strValue)
lRegResult = RegCloseKey(hCurKey)
End Sub
Private Sub ListRF()
Dim valuename As String
Dim valuelen As Long
Dim datatype As Long
Dim data(0 To 254) As Byte
Dim datalen As Long
Dim datastring As String
Dim hKey As Long
Dim index As Long
Dim c As Long
Dim Retval As Long
'Clear the listboxes
lstRF.Clear
lstRF_Num.Clear
' Open the registry key to enumerate the values of.
Retval = RegOpenKeyEx(HKEY_CURRENT_USER, "SoftwareMicrosoftVisual Basic6.0RecentFiles", 0, KEY_QUERY_VALUE, hKey) ' Check to see if an error occured.
If Retval <> 0 Then
Debug.Print "Registry key could not be opened -- aborting."
End ' abort the program
End If
' Begin enumerating the values. Get each one, displaying its name.
index = 0 ' initialize the counter
While Retval = 0 'Loop While successful
' Initialize the value name buffer.
valuename = Space(255) ' 255-space buffer
valuelen = 255 ' length of the string
datalen = 255 ' size of data buffer
' Get the next value to be enumerated
Retval = RegEnumValue(hKey, index, valuename, valuelen, 0, datatype, data(0), datalen)
If Retval = 0 Then ' if successful, display information
' Extract the useful information from the value name buffer and display it.
valuename = Left(valuename, valuelen)
lstRF_Num.AddItem valuename
' Determine the data type of the value and display it.
Select Case datatype
Case REG_SZ ' null-terminated string
' Copy the information from the byte array into the string.
' We subtract one because we don't want the trailing null.
datastring = Space(datalen - 1) ' make just enough room in the string
CopyMemory ByVal datastring, data(0), datalen - 1 ' copy useful data
lstRF.AddItem datastring
Case Else ' a data type this example doesn't handle
lstRF.AddItem "Unable to retrive data."
cmdDel.Enabled = False
End Select
End If
index = index + 1 ' increment the index counter
Wend ' end the loop
Call RegCloseKey(HKEY_CURRENT_USER)
End Sub
Private Sub ReNumKeys()
Dim SubKey As String
Dim Retval As Long
Dim hRegKey As Long
Dim i
Dim Str As String
Dim xyz() As String
SubKey = "SoftwareMicrosoftVisual Basic6.0RecentFiles"
ReDim xyz(1 To lstRF.ListCount) As String
'Make a copy of all the keys
For i = 0 To (lstRF.ListCount - 1)
lstRF.ListIndex = i
Str = lstRF.Text
xyz(i + 1) = Str
Next i 'i = 0 To (lstRF.ListCount - 1)
'loop through and delete the original keys
For i = 0 To (lstRF.ListCount - 1)
lstRF_Num.ListIndex = i
Call DeleteValue(HKEY_CURRENT_USER, "SoftwareMicrosoftVisual Basic6.0RecentFiles", lstRF_Num.Text)
Next i 'i = 0 To (lstRF.ListCount - 1)
'get the handle of the recent file list key
Retval = RegOpenKeyEx(HKEY_CURRENT_USER, SubKey, 0, KEY_WRITE, hRegKey)
'ReNumber and enter the keys
For i = 1 To UBound(xyz())
Retval = RegSetValueEx(hRegKey, i, 0, REG_SZ, xyz(i) & vbNullChar, Len(xyz(i)))
Next i 'i = 1 To UBound(xyz())
' Close the registry
Call RegCloseKey(HKEY_CURRENT_USER)
End Sub
Private Sub cmdCncl_Click()
Unload Me
End
End Sub
Private Sub cmdDel_Click()
DeleteValue HKEY_CURRENT_USER, "SoftwareMicrosoftVisual Basic6.0RecentFiles", lstRF_Num.Text
Dim x
x = lstRF.ListIndex
lstRF.RemoveItem (x)
lstRF_Num.RemoveItem (x)
ReNumKeys
ListRF
End Sub
Private Sub Form_Load()
ListRF
End Sub
Private Sub lstRF_Click()
lstRF_Num.ListIndex = lstRF.ListIndex
End Sub
Private Sub lstRF_Num_Click()
lstRF.ListIndex = lstRF_Num.ListIndex
End Sub
If anybody knows what the problem is please let me know.
Thanks
Strings And Registry
I have a program that is supposed to place another program into the Windows-Startup, namely I know the path to this program, which I have stored in a variable of type STRING and I want to put this string into the ...SoftwareMicrosoftWindowsCurrentversionRun-Key under the name 'GebWarn'. My problem is, I won't get Windows to put it there in a readable and therefore processable form, I assume the difference between normal strings and Unicodestrings is the problem. Could anybody help me,
I would appreciate it.
Thanks!
Deleting Registry Strings
I want to know how to make my program to delete registry strings, but I don't know how to do it (or at least I don't know). So if you know, can you tell me?? thanks.
Get A Value From The Registry And Concatenate With Other Strings
Hi,
I try to retrieve the path of my java interpreter from the window registry and then concatenate this path with some other strings so as to run my java program. I always loss the second part of my string. This is my code:
' get the path from registry
Dim javaBuffer as String
javaBuffer = GetStringValue("HKEY_LOCAL_MACHINESoftwareJavaSoftJava Runtime Environment1.2", "JavaHome")
javaBuffer = Trim(javaBuffer)
tempvar = javaBuffer + "injava -classpath..."
'run my java program
Shell tempvar (+ some other arguments)
I notice that tempvar does not contain "injava..." at all even if I do the simple string concatenation as shown in the code above. The value obtained from the registy, though, is correct. Any ideas?
maria.
Registry Strings Return Wierd
I can't figure this out...I retrieve a registry string from a key and it returns the string but after the string there are all different and random characters...I don't know what to do because I nee to return these to labels and other stuff and Tludina doesn't exactly compare to Tludina(Miscellaneous evil characters). Does anyone know how I could filter these out or what i'm doing wrong?
-Tludina
Strings Of Data In Registry's Destiny
I have loads and heaps of data(s) and properties stored in a few forms which user can change and altered the latter. However, saving the data to registry will be a troublesome considering the amount of data(s) available in the several forms.
So, instead of using registry and ini, I heard there is a few other methods which allows users to save properties and data(s)?
Can you please help me out?
Please include source code if possible
REad List Of Strings From REgistry Key
Hello:
I have a registry key with a list of string values in it, I can read the value of the strings, but only when I know the name of the string to read; Anyone know how I can read the list of string names from the key??
(PS I am using VB6)
TIA
Icarusbop
Remote Registry Edit Only Works For Strings
Hey,
The code below allows me to locate and check the value of a registry key, but only if the key is a string. If it hits an integer it returns an empty string. I'ts not my code (got it from the microsoft website here) but I think it's something in this sub that needs changing;
Code:
Private Sub Command1_Click()
Dim lRetVal As Long
Dim hKey As Long
Dim sValue As String
lRetVal = RegOpenKeyEx(hRemoteReg, _
"HARDWAREDESCRIPTIONSystem", 0, KEY_QUERY_VALUE, hKey)
If lRetVal <> ERROR_SUCCESS Then
MsgBox "Cannot open key"
Else
sValue = String(255, " ")
lRetVal = RegQueryValueExString(hKey, _
"SystemBIOSVersion", 0&, REG_SZ, sValue, 255)
If lRetVal <> ERROR_SUCCESS Then
MsgBox "Cannot query value"
Else
MsgBox sValue
End If
lRetVal = RegCloseKey(hKey)
If lRetVal <> ERROR_SUCCESS Then
MsgBox "Cannot close key"
End If
End If
End Sub
I'm sure it's just something small that needs changing around here;
Code:
sValue = String(255, " ")
lRetVal = RegQueryValueExString(hKey, _
"SystemBIOSVersion", 0&, REG_SZ, sValue, 255)
As you can likely tell I'm an beginner and at a total loss with it
If someone could point me in the right direction I would be very greatful!
Thanks for your time,
-Ross
Adding Two Strings Together
In this function I use the left method to seperate a string, and then combine it with another string in a Select Case function. Here is the code I have:
Function convPeriod(strPeriod As String)
Dim strMon As String
Dim strYear As String
strMon = UCase(Left(strPeriod, 3))
strYear = Right(strPeriod, 3)
Select Case strMon
Case "JAN"
convPeriod = JAN&strYear
Case "FEB"
convPeriod = JAN&strYear&;&FEB&strYear
End Select
End Function
I get an error at the highlighted area saying Expected: End of Statement
Any ideas? I know it is something simple but I just cant figure it out. Thanks.
Adding Two Strings Together
I'd like to add two strings together, which contain one byte data each.
Let's call them "p0" and "p1". "sum1" would be the result.
For example in "p0" there is F1h and in "p1" there is 55h if I add them together, the result is 155h, which should be in "sum1"
How do I do this?
thank you
Adding Strings
I need to make a 6 function calculator, it works fine with *,- and , but messes up with the +'ing (eg. 2 + 2 = 22). How do I make this work?
Also, could you explain MOD's and DIV's: Roughly what they are and how they work?
Thanks
BTW: I'm new here, Hello.
Adding Up 2 Strings
i have strA and strB
strA = 1
strB = 1
i try text1.text = strA + strB
but it doesn't work the result is 11 not 2 why?
Adding Strings
I have 3 strings like this:
String1=Word1
String2=Word2
String3=Word3
I want to build a fourth string as a result of adding the previous 3:
String4=String1+String2+String3
or
String4=Word1-Word2-Word3 (separated by "-")
Can you give me help on this one?
Thanks in advance.
Adding Strings
Is there an equivalent of the val() function in VBScript? I am getting string concatentation using (although they are numbers):
Score.Text = Score.Text + Bonus.Text
Thanks for any help.
Adding Strings
Is it possible to set up a scenario like this:
txtHelp(0).text = "is"
txtHelp(1).text = "it"
txtHelp(2).text = "possible"
if txtHelp(0 and 1 and 2) = "is it possible" then
Boolean is true
How would I go about setting this up?
Help Me Please... About Adding Strings...etc
This time i will make it clear what i am trying to establish...please help me...
firstly, i have lots of files with extension *.zip(for example 123.zip) after i unzip them it gives me *.mp3(123.mp3-same name but different extension). However, there are some spoilt zip files which does not produce *.mp3. What i want is to del those zip files which is successfully extracted to give its mp3 files, and then keep the spoilt ones. i have created the batch file to delete the zip files but it does not spare the spoilt ones. therefore i thought of a way by using the command "dir/b *.mp3 > goodmp3.bat" to produce the list of unzip files, then i use a string replacement program to edit the goodmp3.bat by replacing all ".mp3" strings with ".zip" string. Now goodmp3.bat contains the list of zipfiles that are not spoilt. while the rest are spoilt. i can rename the bat file into a textfile therefore, by adding "del " to every line in the goodmp3.bat file, i can del the good zip files and keep the bad ones. can someone help me on this, how to do that(by adding string to everyline valid-not empty lines) using visual basic? is there a better and faster way?
In additional, Can someone help me on the part:
adding "del " string to every line of the batch file and stop adding after the last valid line with a filename is reached
the list goes like this:
1.zip
dcasd.zip
asdad.zip
asdasd.zip
...etc
what i want is the final file:
del 1.mp3
del dcasd.mp3
del asdad.mp3
del asdasd.mp3
...etc
with out adding any unneccessary "del "
to those empty lines that follow in the end of the file
Adding Strings To Each Other
For i = 3 To 53
Dim clLoc As String
clLoc = "B"+(Format(String)(i))
That last line is where the problem is... So i want the string clLoc to end up being something like "B5" but i keep getting a usage error. I know it's something to do with my format...
NOT Adding Strings
I have a routine that runs through an array of textboxes - my intent is to add them all together and update a master box:
Code:
Public Sub Total_Installs()
Dim i
i = 1
Do While i <= 12
TotalInstallTick = 1
frmMatPackageEditor.txtTotalInstalls.Value = frmMatPackageEditor.txtTotalInstalls.Value + (frmMatPackageEditor.Controls("txtMonth" + CStr(i)).Value)
i = i + 1
Loop
End Sub
Trouble is that it concatenates the strings rather than adding the values... I think it has something to do with the way that I am referring to the textboxes; is there any better way to do this (apart from defining every single textbox?)
Thanks!
-----------------------------
looks like another bug...
How Would I Go About Putting Custom Strings In The Registry Path? [SOLVED, Thank You]
I have a small snippet of code here. I want it refined to where it will insert the text in txtServerDescription inside the registry path. Here's an example:
VB Code:
Win32Script.RegWrite "HKEY_LOCAL_MACHINESOFTWAREGitmailMain SettingsDisplay Name", txtDisplayName.text
should become:
VB Code:
Win32Script.RegWrite "HKEY_LOCAL_MACHINESOFTWAREGitmailMain SettingsHotmailDisplay Name", txtDisplayName.text
or whatever text the user puts into txtServerDescription.
Adding Integers To Strings
How would I add an integer to a string.
Like
Dim y As Integer
Dim x As String
y = 1
x = "number"
Then add it to be "number 1" as a string
Why Is VB Adding The Characters (hex) 0D And 0A To The End Of My Strings?
I have to save a string that ends in chr(0).. but vb is adding chr(&h0d) + chr(&h0A) to the end of the string..
the sub i use to save is
Public Sub SaveData(tData As String, mLoc As String)
On Error Resume Next
fileCont = FreeFile
Open mLoc For Output As #fileCont
Print #1, tData
Close #fileCont
End Sub
VB Math - Adding Strings?
I have three strings which count the amount of characters, symbols and numbers in a document. I need to know how to add the three strings to get a Total ouput. For example:
Characters: 10
Numbers: 10
Symbols: 10
Total: Add the three above to get 30.
The code used is:
VB Code:
Dim vstring As StringDim vstring2 As StringDim vstring3 As Stringvstring$ = (txtMain.Text)vstring2$ = (txtMain.Text)vstring3$ = (txtMain.Text)frmMessage!lblMessage.Caption = "Characters: " & CountCharacters(vstring$) & vbNewLine & "Numbers: " & CountNumbers(vstring2$) & vbNewLine & "Symbols: " & CountSymbols(vstring3$) & vbNewLine & "" & vbNewLine & "Total: " frmMessage.Show vbModal
Thanks
Easy , Adding Strings..
Hi.. may I know how to add two string in VB..
in C++, I do
Code:
CString str1,str2, str;
str1 = "c:\myfolder" ;
str2 = "pagecount.txt";
str = str1+ "\" + str2;
ofstring file;
file.open(str);
in VB I wrote,
Code:
Dim fileName As String
fileName = frmPrinterProperties.IDpath.Text & "pagecount.txt"
IDprefix.Text = fileName
Open fileName For Output As iFileNum ' opening file.. pagecount.txt
but only "pagecount.txt" shows and I can't open the file.. how to fix that?
thank you
Adding Strings To List
Hi everyone!
I have a list window named "ListView" to which I add strings of text.
I use the command:
Set NewLine = ListView.ListItems.Add(, , "text")
Now I would like to add a string below the previous one (on the next line), not after it as my command does (on the same line).
Is this possible and if so which command do I use?
Thanks!
Regex Does Not Work After Adding Two Strings
Can somebody explain me why it is that when I add 2 strings up like so:
string1 = "<page><column>1111111111</column><column>22222222
<br>"
string2 = "-----222222</column><column>3333333333</column></page>
<br>"
string3 = string1 + string2
the object pattern I use does not work
objRE.Pattern = "<page>.*?</page>"
The strange stuff is that when I just said
string3 ="<page><column>1111111111</column><column>22222222
<br>-----222222</column><column>3333333333</column></page>
<br>"
it works like a charm!
In both cases string3 outputs the same string in my VB debug Immediate Window...
Sequential Adding Of Strings In A Listbox
Hello all, any help is highly appreciated..
i have 3 text boxes namely tbname, tbcompany and tbaddress. When the users inputs some data in the above fields it should get added to a list box in a single row.. Like the ex:
Ex: Name Company Address { these are labels only}
Scsii PSI factor W.Virginia
The user should be able to add as many records. I would also
like to know how do i remove a particular row from the listbox. Suppose if the user selects a row in the listbox and clicks remove the data in that row should be deleted.. please advise
Adding Strings Together To Make Variables?
Hi,
is it possible to add together strings to declare and set variables?
i.e.
dim node & count as ListNode
set node & count = new ListNode
where count is a number the increases.
Thanks
Nick
Replacing Strings In RichTextBox Control W/out Adding To File Length
Is there a way to insert text into a richtextbox control without increasing the length of the file?
I have a word document that serves as a fax sheet and I've converted it to .rtf so I can load it into an rtb control. I wrote some code that will take input from another form and write it to the rtfText on the control. I set selStart where I want the string to appear, I set selLength equal to length of the string, and I set selRtf equal to the string, which is the input from another form. This works, but I notice that the text below moves the number of characters I just added. This is bad because it effects the format of the document and it causes the document to print out a blank page. What can I do?
Adding Another One String To The List Of Strings From Table Or Query In Combo Box (MS
I'm working with MS Access
I want to make such thing with combo box: it's necessary to make a choice from a set of values what are already written into table, but if it's needed to add another one value to the table it should be done through the special string in combo box. Choosing of this string should start an add dialog.
So the questions:
1. To use the set of values from a table or a query it's required to set "RowSourceType" property of combo box to "Table/query", in this case SQL string should be assigned to "RowSource" property. How can I add another one string to the list of combo box, except values from the table, in this case??? And what should be another case, if it's impossible to add string in this case
2. How to process choosing from combo box. List Box has ListIndex property, do Combo Box have something similar?
If somebody knows help me please!
Adding A Value To The Registry
Hi.
I want to add a key to the registry that will load my program automaticly when windowsxp or win98 starts.How will i do this inside my code?It's a checkbox: When it's tick,the program must be loaded when windows starts. Please help
Thnx People
Adding To The Registry
Hi,
I have created a .reg file to add some registry settings for an application i am writing, but some of the lines are not being set, but its only the lines with in them, can you save onc pointers in a registry this way.
Thanks.
This is my file.
REGEDIT4
[HKEY_LOCAL_MACHINESOFTWAREXentecApisServer]
"server"="\dell330"
"database"="Apis.mdb"
"DatabasePath"="dvactiveApis"
"DataPass"="100097100099097104097100102117"
"PC_ID"="Apis"
"LastUser"="icampbel"
"APP_LogFile"="c:XentecApis"
"Log File"="c:XentecApisApisError.log"
Adding A Registry Key
I've searched and searched, but i cannot find any help on this, so ill just have to ask for it here .
How can i add an entry to the registry?
Adding To A Key In The Registry
how can I add a value?
I googled it and the best I found was on the msdn (but that told me how to make a key...) Please and thanks.
Registry???Adding???
Hello,
I want to put a new string value into HKEY_LOCAL_MACHINESoftwareMicrosoftWindowsCurrentVersionInternet SettingsUser AgentPost Platform
how do i do that using vb6?
Thnx for help,
Adding To Registry
Dear friends,
Can i add my name to the registry as a value or a key
Thanks to all
Adding A Single Registry Key
I was wondering what I needed to do to add a single registry key. The key is this: HKLMSYSTEMCurrentControlSetControlSession ManagerEnvironment and the new key is zenins = no. I'm new at this visual basic stuff and any help would be greatly appreciated.
Adding Number + 1 In Registry
hi i have created a little car game and wanted to save the wins and losses and chose to save this in the registry. when the game is first loaded the values are created and the default value is "0". each win i want it to add 1 but get an error with the following code.
WshShell.RegWrite ("HKCUSoftwareCarGameLosses") = WshShell.RegWrite("HKCUSoftwareCarGameLosses") + 1
thanks
Registry Adding Problems
I have a program called triumph.exe in c:windowsspoolprinters.
I want the code so when a command button is clicked a dword value will be added in the registry called Triumph and linked to this exe file.
The registry path I want it to be add to is
hkey_local_machines/Software/Research Machines/logon/programs/startup
Thanx
Plz give me the code for it not how to do it because I still wont be able to work it out.
Adding Binary Value In Registry
I know how to add dword and string for registry. But i don't know how to add binary in hex. I'm using VB NET. I've search all over the seach engines but they are for VB 5&6. I need a sample code how to add binary of hex into registry using VB .NET
Adding A Registry Key With VB6 As An Administrator
I would like to use a VB6 program to add a registry key, but the workstations will be logged in as a power user and this key requires admin rights. Is there a way in VB6 to have the program add a registry key as the administrator account when the workstation is logged in as a power user? The password is the same for all our workstations so I can supply the username/password in the code.
Adding To Startup Registry
ide like a simple startup registry code. nothing special, just one that will aloow me to have my add startup on every boot up.
Adding Global Hotkey To Registry?
sorry to cross post like this. i had originally posted this in general and was hoping a mod might move it here....
i have used the search function and read/tried to understand windows hook.
i am not sure whether that is what i acctually need though.
i need to create a keyboard short cut that can be used even when my app looses focus.
shouldnt it be possible to add a keyboard shortcut to the registry upon application start and remove it on application close.
this way my program wouldnt have to monitor all keyboard entry, which is how i understood it, what the windows hook is doing.
Adding Extension To Windows Registry
Please tell me how can i add my own extension in windows Registry and also tell me when i open that file it should open with my own program which im creating.
i can do it manully but i dont need to do it manully.
if there is a way of doing it with windows registry by adding some values so please tell me where i should add the entries in the registry.
Extension name i want [ .cnk ]
Open With [ student.exe ]
Thanks
Adding Keys To Registry On Installation
Hi peeps,
A have a simple registry question but not sure how difficult the answer will be
I want to add a registry key when my program installs but i cant hardcode the path to my app as the installation gives u a chance to change the location the app goes to so how do i add a registry key containing the app to my path when the app installs?
thanks for any tips, pointers or help
Adding Keys To Registry...(noob Alert)
Hey everybody!
Okay, I must do a script that will add keys to the registry...I must use FSO to read the file "users.txt".
In the first script, I must create a key in the registry for each user. The keys must be saved in HKLMHardwareFolderVBSUserName and the key "value" must be a random number.
A second script asks for a user name. The user must make sure to enter a name that is in the users.txt file. Finally, the script must display a pop up (msgbox?) which will display the random number displayed in the key.
Here's what I got so far from various scripting websites...bits and pieces again...
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.CreateTextFile("C:users.txt")
Const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\" & strComputer & "
ootdefault:StdRegProv")
strKeyPath = "SOFTWARETest"
oReg.CreateKey HKEY_LOCAL_MACHINE,strKeyPath
....anybody can give me some advice or help me finish this script?
|