-
How do i read lines in a textbox
[Originally posted by Ben]
How do i read lines in a textbox,
I use the open and open a file into the textbox
Text1, when i use :
Text1.Selstart = 0
Text1.SelLength = 200 it copies the whole line plus next line
line number 2, how can i just read the line i need
say i need line 20 this time i need to read the line, i would need the code that can do this job incase i am anotehr window, i had to leave the Text1.SetFocus out, also i had
to leave the SendKeys "{+END}", True because i maybe
in another window to avoid jumping to my program to get a line in a textbox Which is text1 how can i read any line in text1 text1 has 200 lines so i hope you can help me out with
a code that can get the line of text i need to get Line number
55 in a textbox how i go's about doing that.
Thank You Have nice Sunday Evening all
;)
Bye
-
Re:How do i read lines in a textbox
[Originally posted by FreeVBCode.com]
I think the code I just posted at <A HREF = 'http://www.freevbcode.com/ShowCode.Asp?ID=2493'>http://www.freevbcode.com/ShowCode.Asp?ID=2493</A> solves this problem.
-
Re:How do i read lines in a textbox
[Originally posted by Brat]
You could try using the Scripting Tools by adding Microsoft Scripting Runtime to your References in your Project.
Dim FSys As New FileSystemObject
Set File = FSys.GetFile("Your Text File Here")
fileText = TStream.ReadLine
in which fileText is a string (or variant) variable
or
Dim InStream as TextStream
Set InStream = FSys.OpenTextFile("Your text file here",1,False, False)
While InStream.AtEndofStream = FALSE
TLine = InStream.ReadLine˙
(Line number would be TLine)
Your code would be this:
55 = InStream.ReadLine
txt = txt & TLine & vbCrLf
Wend
Text1.Text = "The following text was read from file" & vbCrLf
Set InStream = nothing
You may have to play with this to work for you.
I don't know if this will help you but check out the syntax/code
in one of many VB books, most should have info on using Scripting with VB.
-
Re:Re:How do i read lines in a textbox
[Originally posted by Ben]
Hello Thank You i new to calling Funcations
i don't no how to call a function like this one
Public Function GetTextBoxLine
CAn you help me with the answer anyone i use
to Calling Sun Procedures and some Fucntions
al longs the Function˙ looks like this
Public Function GetTextBoxLine()
end Function
Anything like
Public Function GetTextBoxLine(Index as String, Brainy as String)
It loses me cause it wont let me call it
I would call it something like this i think
GetTextBoxLine = H("c:\text,")˙
I'm not sure
Thank You for any help i'm sure stuck on
this code i tried the Open Statement ,InPut$
function still can't read the lines in a textbox.
Bye and Thank You FreeVbCode.com for repling.
Have nice Monday Evening.
-
Re:Re:How do i read lines in a textbox
[Originally posted by Ben]
Hi
Thank You Brat i try that one i just posted something about the function calling new stuff for me i learned some but, not much that make the call to a function If there nothing all the right
of the function then i can place a easy call to that function, if there is something on the right of the function then calling it
with the example
call Howareyoutoday
if it look like this
Sub Howareyoutoday()
end Function
Then i'm fine,
Sub Howareyoutoday(Index as String, X as String)
end Function
I get into troble because i'can't call it.
Thank You..... Cya later
-
Re:Re:Re:How do i read lines in a textbox
[Originally posted by FreeVBCode.com]
This would get line 4 of your text box and assign it to the variable sLine:
sLine = GetTextBoxLine(text1, 4)˙
-
Re:Re:Re:Re:How do i read lines in a textbox
[Originally posted by Ben]
sLine = GetTextBoxLine(text1, 4)˙
I'm missing something it had an error
Type Mismatch
I made this code out of what you send me
Dim sLine, GetTextBoxLine
sLine = GetTextBoxLine(Text1, 4)
Text2 = sLine
Sub or function not defined
Then i tried this
Dim sLine, GetTextBoxLine
sLine = GetTextBoxLine(Text1, 4)
Text2 = sLine
and got this error
With a error
Hummm i wonder if i need the function on the
GetTextBoxLine ???
Thank You
-
Re:Re:Re:Re:Re:How do i read lines in a textbox
[Originally posted by FreeVBCode.com]
Dim sLine as String
sLine = GetTextBoxLine(Text1, 4)
Text2 = sLine
-
Re:Re:Re:How do i read lines in a textbox
[Originally posted by Brat]
You may have to Dim the call outs first
Dim Index as String
Dim X as String
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks