Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Read And Writing New Line To Multiline Registry String


I've been a bit confused with some of the registry examples I've seen so far...

Theres a registry string that may or may not exist. If it doesn't I want to add it. I need to check this string and if it does exist I need to write a new line without overwriting the previous data.

How can I achieve this?

Sorry if the question is vague.

Thanks




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
How Can I Read One Line By One Line From A Multiline Text Field ?
i have a few rows of data on the text box

is there anyway to do this ?

How To Read Each Line From Multiline Textbox?
Hey All,

I use the following code to read each line from a text file (.txt).


VB Code:
Private Const NUMOFTXTBOXES = 6  Private Sub Command1_Click()    Dim strArray(0 To NUMOFTXTBOXES - 1) As String    Dim i As Long    Dim FileHandle%    Dim strFileName As String     strFileName = "C:Testtext.txt"     FileHandle% = FreeFile    i = 0     Open strFileName For Input As #FileHandle%        Do While Not EOF(FileHandle%)            Line Input #FileHandle%, strArray(i)            i = i + 1        Loop     Text1.Text = strArray(0)    Text2.Text = strArray(1)    Text3.Text = strArray(2)    Text4.Text = strArray(3)    Text5.Text = strArray(4)    Text6.Text = strArray(5)     Close FileHandle%End Sub


My question is...how can I do the same thing, but read each line from a
multiline textbox instead of a text file?

Thanks in advance,
Ron

Read Specific Line Of Multiline Textbox?
I've only been working with VB for a very short time. I'm trying to read a specific line of a multiline text box. For example, I wish I could do something like this:

Dim Line4Data

Line4Data = txtBox.Text (line = 4)

Is there an easy solution to this? Everything I've read starts talking about SQL databases and blows my mind.

Thanks.

Multiline File Into A Single Line String.
This problem always keep comming up. When reading from a file that has multiple lines during debug (though i only need the first line), the program works fine. But when compiled and trying to read from it, the it somtimes reads the first line as null and i have to make code that will read the second line. In notepad it says it's the first line.


VB Code:
Open Filename For Input As #1Line Input #1, File_ContentsClose #1


^^^^^ Code used.


Any way, what i want to know is how to load the entire file contents into a string. No matter how many lines or what ever else.

If i had this stored in a file:

QWERTY
ASDFGH
ZXCVBN

and loaded it, i want it to look like this in a string "QWERTYASDFGHZXCVBN"

Can anyone help me out?

Read/Writing To The Registry W/o Save/getsetting
Say, how does one go about writing to and reading from the registry without using savesetting and getsetting?
thanks
kevin

Writing Blank String Values To The Registry
Hi There,

I have just started to use the API for the first time to read/write from the registry and i have come accross a problem.

I'm writing a pair of utilities, the first is the actual utility the other is a configuration util for the first.

The util is designed to shell out and load a program and pass command line paramaters, im storing the paramaters in Hkey Current User.

I have pasted the sample from the API Guide in to a module and got the config util to write to the registry, the problem is that then i load the program back up and it reads the values i have stored it comes up with an error, i Tracked it down with debug and found it was when it was trying to read a string i had set to the contents of an empty textbox.

I need to be able to write nothing in this field if possible

How do i work around this problem?

Writing String To A .txt File At A Line
Hello I need to write a string to a line in a .txt file.

Now I've got this code from the internet:

Code:
Public Sub InsertLineToSettings(ByVal strFile As String, ByVal lineNumber As Long, _
ByVal strLineOfText As String)
Dim strBuff() As String: strBuff = Split(returnContents(strFile), vbCrLf)
Dim i As Long
Open strFile For Output As #1
For i = 0 To UBound(strBuff)
If i = lineNumber Then Print #1, strLineOfText
Print #1, strBuff(i)
Next
Close #1
End Sub
But I get an error at this part:

Code:
strBuff = Split(returnContents(strFile), vbCrLf)
"returnContents" is higlighted then
It sais :
Sub or Function not defined.

I've got the code from here: http://codeitbetter.gigcities.com/vb...Code00438.html

Could someone help me to solve this, or does anyone has an better idea?

What I have to do is this:
I have a string with a unique line number, this string has to be written in a txt file at the defined line. Please help. Thanx in advance.

Read Multi-string Registry Value
hi people.

im stuck on reading a multi-string registry value. If you have any shared folder on your computer you can see the problem im getting here:
HKEY_LOCAL_MACHINESYSTEMControlSet001ServiceslanmanserverShares

Im trying to read the key "wireless" and the value is:
CSCFlags=0
MaxUses=4294967295
Path=C:Documents and SettingsmeDesktopNew Folder
Permissions=0
Remark=
Type=0

but via reading it normally i only get "CSCFlags=0" but how can i get all that data not just the first line?

thanks

Registry (Save And Read) And Get The # Of Lines In A String!
Since I don't know how to properly use API, can someone please write me a code that has 2 functions (1 for writing strings into the registry and the other for reading from the registry!). Thanks for your help.

Read String Line By Line
if the original string is

aaaa
bbbb
cccc
dddd
eeee
ffffff



if i want to convert it as

a(1) = aaaa
a(2) = bbbb
a(3) =cccc
a(4) = dddd

sorry for a naive question !

String Truncated When Read Via Line Function
I am reading in a txt file that looks like this:
33QNATPAUTO1021-02,yes
33QNATPAUTO1018-02,yes


When I run my code, the first column is coming only as 33,which I don' understand why it is doing it that way. I really don't want to split this in an array b/c that increases the complexity of what I am trying to achieve.

Help???
Thanks,
Nadia

Here's my code:
Dim sFile
Dim claimnumber, flag As String
Dim fileNum As Integer
fileNum = FreeFile


sFile = "O:5 Prj MgmtQA SysAutomationTestScriptsClaimsGUIFilesQNAcl.txt"
'Opens the input file and reads in the values
Open sFile For Input As #fileNum
Do While Not EOF(1)
Input #fileNum, claimnumber, flag
Debug.Print claimnumber, flag

Loop
Close #fileNum

Search File For String, Read Next Line
hello,

I am writing a program for MSN Instant Messenger, and one of the features I am adding will store away messages in a file, and at runtime, put the names ("Name=blah" in the text file) into a menu array (would be "blah" in the menu). I have the menu part solved, but would like to have it put the away message that corresponds with the name into a global AwayMessage variable.

IE, you go to the menu item "Away", and click "I am away"
In the text file, it will find 'Name="I'm Away"', and store I'm Away in the menu array

Name="I'm Away"
Message="I'm away from the computer"

Is how the text file would be set up. What I need to know is how to pull the "I'm away from the computer part" from the text file, based on what was clicked. The code I currently have is below:


Code:
Private Sub mnuNames_Click(Index As Integer)
Dim caption As String
Dim sFile As String
Dim lFile As String
Dim line As String

caption = mnuNames(Index).caption
sFile = "C:Documents and SettingsmikeDesktopmessages.txt"
lFile = FreeFile

Open sFile For Input As #lFile

Do While Not EOF(lFile)
Line Input #lFile, line
If Not Len(line) = 0 Then
' Process lines that aren't blank and contain the
' target text.
If InStr(line, caption) Then

IMClient.LocalState = MSTATE_AWAY
End If
End If
Loop

' Close the input file.
Close #lFile
End Sub


I tried my best to explain my problem, but it's not always easy to type everything out, so please bear with :-)

How Do I Read One Line Of String In An Active Document In MS Word?
Hello,

I'm writing a macro that needs to read every single line in an active document in MS Word. I think I need to use ActiveDocument, but don't know what method/property to use to read line by line. Please advice.


Thanks,

How Would I Read A Specific Line From A Text File As A String?
I would like to read configuration from a text file like config.txt
each line would look like: variable value (for example: version "0.9")

What code would i need to write if i only wanted to extract one variable and it's value from the config.txt?

How would i find the variable and read it's value ????


---------------------
~:{Decayed}:~
the.decayed@usa.net
http://www.q3seek.com

Text File Manipulation - Goto Nextline And Read Line As String
Hello, all,

At the moment, I have to read information line by line from a text file, and write approproate information
to another text file:

The input text file is something like this:

Name1 CA USA John Smith
C1 Likes Swimming
C2 Hates programming


Name2 Mel Aus Joe Blow
C1 Likes Swimming
C2 Hates programming
C3 Likes games



The above lines represent the record for John Smith and Joe Blow, however, the feature, can vary from person
to person, eg, Joe Blow can have three features.

I can pretty much extract the info from Name1 and Output into a text file line by line like" (but only from the first line)

Name1
CA
USA
John Smith


Just wondering how would I continue to read the next two lines ans add to this output text file until
there is a blank line?

I am trying to search an option that it goes to next line and validate whether the line is not null, then
go ahead and proceed. Otherwise, search for Name2

Thanks so much for ur help.

Reading Line By Line From A Multiline Textbox
Hi,
Is it possible to read from multiline textbox line by line.ie if textbox contains a value for eg Santh Thomas
     Nampiaparambil House
    Kaloor
then text1.text usually reads the enire value.I would like to read the value line by line ie
first santh thomas then Nampiaparambil House and then Kaloor, may be by using some kind of loop.Please help

santh

Line Input #1, Line...how Do I Read Ahead One Line (or Back Up One Line)
I am loading a file line by line using the LIne Input but at one point i need to look ahead at the next line to decided what to do on the current line...how do i look ahead one line? or how do i use the line Input function and then back up? Any help would be greatly appreciated.

Shane Thomas
p.s. please email replys in addition to the reply of post too
shathoma@nmsu.edu

Need Help.. {Reading/Writing Multiline Text}
Hello.
i wanna save and read multilines from a text file.Plz tell coding..

Writing In A Multiline Textbox By Code
I'm trying to write by code two lines of text in a multiline textbox but i only get the last line displayed.
Is this the right way?

textbox.text = "This is line 1" & chr(13)
textbox.text = "This is line 2" & chr(13)

Writing Multiline Textbox To A File
Hi. Say I have a multiline textbox and I need to write it to a file. But in the text file I want it all to be on one line with no line returns, but when I read it back into the program I want it to show the correct line returns. Any Suggestions?

Writing A Multiline Memo Field To Excel
I'm having a problem with formatting of a multiline memo field when I put it into an Excel cell. The memo field stores customer addresses in an Access database, is read into VB, then exported into an Excel template.

The problem is that every line break in the address appears as a small square once in the Excel cell. Its still breaking the line properly, but the small sqaures need to be manually deleted by the user.

Does anyone know if there is a string manipulation I can do to it before writing to Excel to remove these characters?

The line I'm using now is:

obWorkBook.Worksheets(iQuoteSheet).Range("A" & 10) = txtWorkAddress.Text

Line By Line Text File Read And Correct Each Line
Can anyone help me create a small program or have any pointers
on pieces of code that reads a text file from folder "unfixed" then
fix the contents and then store the corrected contents
in another folder "fixed" and then move the file in folder "unfixed" to folder "old"

Details of contents.
There is a space infront of each line that should be removed.
Between the first group of numbers and the second there should be a zero for every space.
Then after the second group of numbers there should be just one space and the rest trimed off.


011531015222360000500355 3350505212004 50122
011531015222360000500363 5336305212004 6255
011531015222360000503465 2404505212004 50022
011531015222360000503463 1345205212004 50025
02153101522236 13 1503256


The @ symbol represents where a space should be.
I would like to read the file and then correct it and then
place the fixed contents in another folder with the original name.
Below is how I would like it to look.

01153101522236000050035500000003350505212004@
01153101522236000050036300000005336305212004@
01153101522236000050346500000002404505212004@
01153101522236000050346300000001345205212004@
021531015222360000000013@

Read Multiline
I have a problem reading a text file with multiple lines and displaying it to a textbox.

Example my test.txt contains,
ABDADADA
1231414
ASFDAFASFa


I want the 3 lines of letters to be display into a text1 box, the text1 box is set to Multi = True and have a scroll bar.

Below is what i have, it is taken in here.

Private Sub Command1_Click()
Open "C: est.txt" For Append As #2
'Print #2, Text1.Text
Print #2, Text2.Text
Close #2
End Sub

Private Sub Form_Load()
Dim val As String
Open "C: est.txt" For Input As #1
Do While EOF(1) = False
Line Input #1, val
Text1.Text = val
Loop
Close #1
End Sub


I have try to change some of it but it still cant work in printing everything into the textbox.

Do While EOF(1) = False
Line Input #1, val
Text1.Text = val & vbCrLf
Text1.SelLength = Len(val & vbCrLf)
Loop

Thinking that the focus cursor keep overwrittening the previous text been print in the textbox. But i am wrong.

Please guide thanks.

Multiline Read Only Property?
Hello!
I'm building a my control, i have a textbox in it, so i have to make some property of the textbox to became property of the control:
Code:
' MultiLine -
Public Property Get MultiLine() As Boolean
MultiLine = mTEXTBOX.MultiLine
End Property
Public Property Let MultiLine(inVAL As Boolean)
mTEXTBOX.MultiLine = inVAL '****** ERROR ******
PropertyChanged "MultiLine"
End Property
the line i've marked with ****** ERROR ****** generate an error because Multiline is a read-only property....
why?.... and how can i change multiline property of my textbox?

First Line In Multiline Text Box?
How do you get the first line in a multiline textbox?

Go To Last Line In Multiline Textbox
Hi guys,

I was wondering how to go to the last line added in the multiline textbox?
Once I add some text to it it will automatically refresh and go to the first row...

Writing To Registry And Deleting Registry
Hi Fellow Coders how can i use VB 6 to Write to the Registry and delete from the Registry whats the code i need?


Thanks Tom

Maximum Line Of A Multiline Textbox
hi..

i hav a multiline enabled texbox.
is there any way to limit the number of line to be entered?

please advice
thanks.

Clear Line From Multiline Text Box
I have a multiline textbox. I have several listboxes that a user dbl clicks to add a line of data to the textbox. I need to have a button that will remove the line of text in the textbox. I can get it to remove specific text which I define but I want to delete the line not just specific words. Any ideas.

Here is what I have so far code wise:

Code:
Private Sub cmdRemove_Click()

Dim iFoundPos As Integer
Dim sNewString As String, sRemove As String

sRemove = "Jason"
iFoundPos = InStr(1, txtOutput.Text, sRemove, vbTextCompare)

sNewString = Mid(txtOutput.Text, 1, iFoundPos - 1)
sNewString = sNewString & Mid(txtOutput.Text, iFoundPos + Len(sRemove))
txtOutput.Text = sNewString

End Sub

Multiline Text Box >> Into One Line Code
Hi all

I have a multiline text box, but i want it outputted in one line of code. Let me explain.

Here is my multi line text


Blah Blah Blah

Blah Shabba etc


And i want it to be outputted in code like the

"Blah Blah Blah" & bvNewLine & vbNewLine & "Blah Shabba etc"

How would i go about this?

***Resolved*** Checking For New Line In Multiline Txt Box
How can i check if there is a char return (new line) when viewing the text from a multiline text box as a string in code.
I'm guessing its gonna be an asc code.. but i cant find which one.
Any ideas??

Max Line Length In Multiline Textbox
i deleted my other thread to do with this (preventing users enter more than a certain number of characters per line in a multiline textbox) after i found the answer, but i just thought i'd post what i found.


VB Code:
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long Const EM_GETLINECOUNT = &HBAConst EM_LINEFROMCHAR = &HC9Const EM_LINELENGTH = &HC1 Dim m_MaxRows As IntegerDim m_MaxCols As Integer Private Function ColCount(ByRef pTextBox As TextBox) As Integer    Dim lngRet As Long        lngRet = SendMessage(pTextBox.hwnd, EM_GETLINECOUNT, 0, 0)    ColCount = lngRetEnd Function Private Function RowCount(pTextBox As TextBox) As Integer    Dim lngRet As Long        lngRet = SendMessage(pTextBox.hwnd, EM_LINELENGTH, pTextBox.SelStart, 0&)    RowCount = lngRetEnd Function Private Sub LimitText(ByRef pTextBox As TextBox, ByRef pKeyAscii As Integer, pMaxRows As Integer, pMaxCols As Integer)    m_MaxRows = pMaxRows    m_MaxCols = pMaxCols        If (pKeyAscii <> 8) Then        If (pKeyAscii = 13) Then            If (m_MaxCols = 0) Then m_MaxCols = 1            If (ColCount(pTextBox) = m_MaxCols) Then pKeyAscii = 0        Else            If (RowCount(pTextBox) = m_MaxRows) Then pKeyAscii = 0        End If    End IfEnd Sub Private Sub Text1_KeyPress(KeyAscii As Integer)    Call LimitText(Text1, KeyAscii, 10, 50)End Sub

Multiline, Putting Words On The Next Line
How do I get words on the next line in a textbox when they are added from another textbox? So I have a textbox and antoher textbox. The first says hi and the seconds says bye.
I have a command button. When you press the command button I want text to to look like this:
     bye
     hi
Not
     bye hi
So command one adds hi to text2. I probbly could give it enough spaces so it does put it on the next line but I need a easier way.

History - A thing of the past
Those who dont know the past are bound to repeat it.
Veni, Vidi, Vici - Julius Caesar

Writing Data To File Line By Line
With VB is there an output equivalant to Line Input? like maybe Line Write or something?

Store First Line Of A Multiline Text Box In A Variable
I have a text box in a form that has several lines of information. This text box is basically going to sent as the message in an email. I would like to be able to click a button on the form and store the first line of the text box in a variable so I can call the variable to use it as the subject of the email. Any help with this would be much appreciated. Thanks.

Clear Single Line From Multiline Textbox
I have a Multiline textbox in which I input data from listboxes. I want to know how to remove a single line of the textbox via a clear item button.

Any help would be wonderful.
Q

Trivual Question On Going To The Next Line Of A Multiline Textbox
Hey,
OK, this is kinda embarassing, but i have absolutly no idea how to go to teh next line of a multi-line = True textbox *blushes, hangs head in shame* lol...heres the code for part of a AI Bot:


Code:
Private Sub cmd_send_Click()
comp = "Jack: "
user = txtuser.Text & ": "
stringbuffer = txtinput.Text
txtoutput.Text = txtoutput.Text & stringbuffer <--GO TO NEXT LINE
Dim n As Integer
For n = LBound(uReplies) To UBound(uReplies)
Debug.Print uReplies(n).sFind
If Trim(LCase(txtinput.Text)) = uReplies(n).sFind Then
txtoutput.Text = txtoutput.text & comp & uReplies(n).sReply <--GO TO NEXT LINE
End If
Next n
End Sub

Thanks for help with this, i know its a simple question, but my searches turn up loads of crap

-Ross

Multiline Textbox, Reading Proper Line?
How do you read a "desired" line in a multiline textbox? ive searched and searched

Multiline Textbox To Single Line In Textfile
Like the title says...
I can't figure this one out...
For example... I have a multiline textbox with the content:

Code:
Line1
Line2
Line3

But I want to write it to a textfile on a single line... The problem is that I don't want the carriage returns lost!

Anyone got a clue?

Thx allready

How To Manage The Length Of Each Line In A Multiline Textbox?
I have a multiline textbox, and I would like to manage the length of each line. Once each line reaches 45 characters, I would like to automatically insert a VBCRLF in between each 45 characters with a maximum of 5 lines. So the entire textbox can only have a maxlength of 225 characters with 5 lines of 45 characters.

I would like to place the code in the textbox_change event so that it automatically formats the text, inserting carriage returns where necessary.

Any guidance or source code is much appreciated.

Brandon

Determine The Current Line In A Multiline TextBox
Hi,

Is there anyone out there who can show me how to get the current line in a multiline textbox. It would be based on my cursor. So if my cursor goes to line one, then line number is line one, if it's on line four then line number is line four.

This is on VB6

Any help will be much appreciated.

Thanks a lot!

Length Of Each Line In Text Box With Multiline Option.
Is it possible to set the length of each lines in a text box with Multiline property set to true?

Thanks in advance.

I Want Copy Multiline Text To A Single Line Textbox
i have a textbox and a comboBox in a form.
and the textbox's Multiline propty is false.
when user copy Multiline text into it twice or more ,something unusual happened.
comboBox can't display list and memery is not enough happened.
the Attach Files is the code.
someone can help me?thanks

Multiline/line Wrap Property Of A Label? *DELETE ME*
Is there a property or a way to change a label similar to changing a text box so that the text on a caption doesn't wrap over two lines?

Delete Single Line/sections Of Multiline Text Box
is it possible to:
a) delete the line that a cursor is on in a multi line text box
b) delete all characters between two 'markers'

e.g.
{
        "Delete Me"
        "And Me"
        "Until You Get Up To Here"
}

is that possible?

any help 'preciated

Read, Find A Line And Delete The Line In Text File
Hi, I am writing codes to do the following things: read a line from a text file, if this is a matched line, delete the line and go to the next line.

Can any one give me some direction? Such as access mode, method to use, etc.

Thanks.

.Input ( Read Contentsof Text File - Line By Line )
I'm trying to import Data from a text file, which includes the following,

Vessel Name
000115600
000025600
000000000
000089000
000019000
000000000
6670.43

The above file is updated every five minutes and I wish to retreive this data in
order to perform calc's and then display a completion time for a process on the
User Form.

code:-----------------------------------------------------------------------------
---
Open "YourFile.txt" For Input As #1
While Not EOF(1)
Input #1, YourVariable
List1.Additem YourVariable
Wend
Close #1
--------------------------------------------------------------------------------

Instead of adding to a list as in the above example, I want to process it Line by
Line ( How do I achieve this using .Input ).

Help

Multiline String
how can i read all lines from a string ? im using left(data,1) the first letter from data but i want from all lines not just the first one

Putting The Contents Of A List Box (each Line) In A Multiline Text Box?&lt;&lt;RESOLVED&gt;&gt;
hi guys how would i put the contents of a list box in a multiline text box

Copyright © 2005-08 www.BigResource.com, All rights reserved