|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|||
|
Quote:
This is a place for learning isn't it? How can you learn with out any visual code to view? Many Thanks, |
|
|||
|
As Nilpo is currently offline,
Do you know how the code can be adapted to search actual fields instead of the ":". At the moment the code searches the following string(s) in a multi line text field, and returns the data after the ":". Date: 12/12/06 Name: Bill Age: 19 Is there anyway the code can be adapted, to search the hole field, i.e. Date:, Name: Age:, with the ":" Reason why, as if the data in the text field contains a ":" the code screws up, and extracts the wrong data. This won't happen if the field name is included aswell i.e. Name: Many Thanks, Many Thanks, |
|
|||||||||||
|
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
vb Code:
__________________
Click the image if at any point you don't like my decision.10011100011000101111100011100000011000000100000011 10010011011110110001101101011011110100011000001110 0100111101000100001 Visit Nilpo.com and Ask the Windows Guru! Open me for some very useful links!
![]() Last edited by Nilpo : February 8th, 2007 at 01:50 AM. |
|
|||
|
Thats the problem, i forgot to mention ealier that the textbox contains the following (including to new lines after "<Name> has sent the following information:"):
<Name> has sent the following information: Date: 12/12/06 Name: Bill Age: 19 Is there anyway the code can be adapted, to search the hole field, i.e. Date:, Name: Age:, with the ":" as if the data contains a ":" the program will get confused, and will therfore extract incorrect information. Many Thanks, much appreciated P.S Sorry to be a pain in the arse!!!! |
|
|||
|
Quote:
Code:
Dim sText As String Dim sDate As String Dim sName As String Dim sAge As String Dim arrText() As String Dim count As Integer sText = text1.text ' Get line count count = InStr(sText, vbNewLine) ' Size our dynamic array ReDim arrText(count) ' Split our text string into an array housing individual lines arrText = Split(sText, vbNewLine, -1, 1) ' Pull the last 3 strings from our array, ignoring any and all before it sDate = arrText(Ubound(arrText) - 3) sName = arrText(Ubound(arrText) - 2) sAge = arrText(Ubound(arrText) - 1) ' Parse each line for ": " followed by data entry and reassign to our variable sDate = Right(sDate, Len(sDate) - 4) sName = Right(sName, Len(sDate) - 4) sAge = Right(sAge, Len(sDate) - 3) |
|
|||
|
The code you post previously, doesn't search the textbox for the field names "Date:, Name:, & Age:" inorder to extract the data shown below.
Also if the contents of the textbox was to include an additional ":" say within the data, the program returns the wrong value. Is there anyway the code can be adapted, to search the hole field, i.e. Date:, Name: Age:, with the ":" as if the data contains an additional ":" within the data, the program STILL gets confused, and extracts incorrect information. CURRENT TEXTBOX CONTENTS: Date: 12/12/06 Name: Bill Age: 19 DATA EXTRACTED FROM TEXTBOX 12/12/06 Bill 19 Many Thanks, much appreciated! P.S Sorry to be a pain in the arse! :-) Last edited by Salchester : January 3rd, 2007 at 11:09 PM. |
|
|