Reading a single line in a multiline text box 
Author Message
 Reading a single line in a multiline text box

Help me please.

I can't find anything on how to read a single line in a
multiline text box. Any sample or a direction on where
to look would be appreciated.
Thanks in advance.

Mike.............



Sat, 17 Oct 1998 03:00:00 GMT  
 Reading a single line in a multiline text box

Quote:

>Help me please.
>I can't find anything on how to read a single line in a
>multiline text box. Any sample or a direction on where
>to look would be appreciated.
>Thanks in advance.
>Mike.............

Mike
 don't mean to be misunderstanding your query but:-

Surely if the is only ONE line, there is one line!
If that ONE line goes into a multiline text box, only ONE line will be
displayed. If it is displayed, surely you can read it.....

That being said, I am sure that the interpretation of your posting is
not the right one.

Where have I missed out??? HELP!

regards

Donald Gray
Free Agent V1.0 -
Eudora Lite V1.5.4
Please do not short the output or severe damage will be caused to the fuse.
         (On a Sony power supply leaflet!)



Mon, 19 Oct 1998 03:00:00 GMT  
 Reading a single line in a multiline text box


Quote:
Allen) writes:

> I can't find anything on how to read a single line in a
> multiline text box. Any sample or a direction on where
> to look would be appreciated.

I have a feeling the VBKB article called something like
"Using the WIN API to optimse text boxes" deals with this.

 _  _____  _   _

| || (_) || `\| | http://www.sn.no/~balchen/igloo/
| ||  _  || , ` |
| || | | || |`\ | If a train station is where a train
(_)(_) (_)(_) (_) stops, what is a workstation?



Mon, 19 Oct 1998 03:00:00 GMT  
 Reading a single line in a multiline text box

Quote:

>Surely if the is only ONE line, there is one line!
>If that ONE line goes into a multiline text box, only ONE line will be
>displayed. If it is displayed, surely you can read it.....

Let me rephrase my question:

I can't find anything on how to read a SPECIFIC line in a
multiline text box containing MORE than one line of text.

example:

Textbox line 1
Textbox line2
Textbox line 3
Textbox line 4

I need to read line 3  from above without knowing what text has been
input in line 3.

Thanks



Tue, 20 Oct 1998 03:00:00 GMT  
 Reading a single line in a multiline text box



Quote:
>I can't find anything on how to read a SPECIFIC line in a
>multiline text box containing MORE than one line of text.

Following is an extract from a test app I use, to remember how to do it.

Global Const WM_USER = &H400
Global Const EM_GETLINE = WM_USER + 20
Global Const EM_GETLINECOUNT = WM_USER + 10

Declare Function SendMessageByString Lib "USER" Alias "SendMessage"
(ByVal hWnd%, ByVal wMsg%, ByVal wParam%, ByVal lParam$) As Long

Declare Function SendMessageByNum& Lib "USER" Alias "SendMessage" (ByVal
hWnd%, ByVal wMsg%, ByVal wParam%, ByVal lParam&)

'To get number of lines in multiline TextBox.
Dim lnumlines As Long
lnumlines = SendMessageByNum(Text1.hWnd, EM_GETLINECOUNT, 0, 0&)

'To get a specific line
Function GetALineFromTextBox$ (ThisTextBox As TextBox, LineNumber%)

'When retrieving a line into a buffer the first word
'of the buffer specifies the max number of bytes to read,
'so one has to guess the maximum line length.  When the bytes
'are read into the buffer the first word gets overwritten.
'Remember that lines in a TextBox are numbered starting at zero.

  Dim lret As Long
  Dim buffer As String
  Dim linelen As Integer

  linelen = 128
  buffer = Space$(linelen)
  Mid$(buffer, 1, 1) = Chr$(linelen And 255)
  Mid$(buffer, 2, 1) = Chr$(linelen \ 256)
  lret = SendMessageByString(ThisTextBox.hWnd, EM_GETLINE, LineNumber -
1, buffer)

  GetALineFromTextBox = RTrim$(buffer)

End Function

References:
  The VB Programmers' Guide To The Windows API
   Daniel AppleMan

  The VB Knowledge Base

--------------------------------------------
Richard Mason, Stevenage, UK


--------------------------------------------



Wed, 21 Oct 1998 03:00:00 GMT  
 Reading a single line in a multiline text box

Quote:

>I can't find anything on how to read a SPECIFIC line in a
>multiline text box containing MORE than one line of text.

Do yourself a BIG favor, and get the VB Knowledge Base file
(vb_tips.hlp) from ftp.microsoft.com, under Softlib/MSFiles (or
something close).

Article Q141073 contains this beauty:

        Private Function fGetLine (LineNumber As Long)
              '* This function copies a line of text specified by LineNumber
              '* from the edit control. The first line starts at zero.

Sorry, but I won't print it here, cause it's a bit long, and this
should be part of your toolbox, and VB programmer's toolbox, just like
the VB.HLP file. I know some people have complained in this newsgroup
that they could not download this file because it's large (5 meg
compressed?), and I can only pity them, the way I pity people with
intel 286 computers since they cannot run Windows 3.1.

(Okay, I'll mail the code to you if you e-mail me a request, but just
this once, right?)

Good luck.



Wed, 21 Oct 1998 03:00:00 GMT  
 Reading a single line in a multiline text box


Quote:
>I can't find anything on how to read a SPECIFIC line in a
>multiline text box containing MORE than one line of text.

What you are looking for might be in the Knowledgebase, but can
definaitly be found in Appleman's guide to the API.  For VB3 & the
16-bit API for windows 3.1, you want to send a message to the textbox,
specifically, the EM_LINEINDEX, EM_LINELENGTH, and the EM_GETLINE
message using the SendMessageBynum API call.

It's late and I don't want to type it all out right now.  Besides, you
might need the VB4 way of doing it...

  -- Robert



Mon, 26 Oct 1998 03:00:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Reading a single line in a multiline textbox

2. Assigning Multi line text to a multiline text box

3. Starting new line on multiline text box

4. Line length & count for multiline Text Box

5. Read a MultiLine textbox line by line?

6. Q: Change Color of Single Line in Text Box

7. How to set the curso on the first single line input text box of my page

8. Value single line text box with variable containing special characters

9. need to right justified numbers in a single line text box

10. Reading one line at a time from a text box

11. Adding text to a multiline text box

12. Displaying text in a multiline text box

 

 
Powered by phpBB® Forum Software