Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   Dev Hardware ForumsSOFTWAREProgramming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Hardware Forums Sponsor:
  Trader Rating: 0 · #16  
Old January 3rd, 2007, 04:50 AM
mphill's Avatar
mphill mphill is offline
untitled
Dev Hardware Expert (3500 - 3999 posts)
 
Join Date: Oct 2005
Location: Zagreb
Posts: 3,726 mphill User rank is General 59th Grade (Above 100000 Reputation Level)mphill User rank is General 59th Grade (Above 100000 Reputation Level)mphill User rank is General 59th Grade (Above 100000 Reputation Level)mphill User rank is General 59th Grade (Above 100000 Reputation Level)mphill User rank is General 59th Grade (Above 100000 Reputation Level)mphill User rank is General 59th Grade (Above 100000 Reputation Level)mphill User rank is General 59th Grade (Above 100000 Reputation Level)mphill User rank is General 59th Grade (Above 100000 Reputation Level)mphill User rank is General 59th Grade (Above 100000 Reputation Level)mphill User rank is General 59th Grade (Above 100000 Reputation Level)mphill User rank is General 59th Grade (Above 100000 Reputation Level)mphill User rank is General 59th Grade (Above 100000 Reputation Level)mphill User rank is General 59th Grade (Above 100000 Reputation Level)mphill User rank is General 59th Grade (Above 100000 Reputation Level)mphill User rank is General 59th Grade (Above 100000 Reputation Level)mphill User rank is General 59th Grade (Above 100000 Reputation Level)  Folding Points: 14729 Folding Title: Novice Folder
Time spent in forums: 3 Months 2 Weeks 5 Days 7 h 51 m 48 sec
Reputation Power: 4879
Send a message via ICQ to mphill
Homework?
__________________
Click Here ->    

Reply With Quote
  Trader Rating: 0 · #17  
Old January 3rd, 2007, 07:25 AM
Salchester Salchester is offline
Contributing User
Dev Hardware Newbie (0 - 499 posts)
 
Join Date: Aug 2005
Posts: 294 Salchester User rank is Corporal (100 - 500 Reputation Level)Salchester User rank is Corporal (100 - 500 Reputation Level)Salchester User rank is Corporal (100 - 500 Reputation Level)Salchester User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 23 h 37 m 7 sec
Reputation Power: 5
Quote:
Originally Posted by mphill
Homework?
NO!, Why does everybody think this/everything else is homework?

This is a place for learning isn't it?

How can you learn with out any visual code to view?

Many Thanks,

Reply With Quote
  Trader Rating: 0 · #18  
Old January 3rd, 2007, 07:52 AM
Salchester Salchester is offline
Contributing User
Dev Hardware Newbie (0 - 499 posts)
 
Join Date: Aug 2005
Posts: 294 Salchester User rank is Corporal (100 - 500 Reputation Level)Salchester User rank is Corporal (100 - 500 Reputation Level)Salchester User rank is Corporal (100 - 500 Reputation Level)Salchester User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 23 h 37 m 7 sec
Reputation Power: 5
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,

Reply With Quote
  Trader Rating: 2 · #19  
Old January 3rd, 2007, 02:15 PM
Nilpo's Avatar
Nilpo Nilpo is offline
Dev Hardware God (5000 - 5499 posts)
 
Join Date: May 2004
Location: Salem, OH
Posts: 5,404 Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)  Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 1 Month 1 Week 3 Days 19 h 42 m 53 sec
Reputation Power: 6193
Send a message via ICQ to Nilpo Send a message via AIM to Nilpo Send a message via MSN to Nilpo Send a message via Yahoo to Nilpo Send a message via Google Talk to Nilpo Send a message via Skype to Nilpo Send a message via XFire to Nilpo
MySpace Orkut
Quote:
Originally Posted by Salchester
What is CSV?
CSV stands for Comma Separated Values. I'm asking if you want to have a delimited (database style) text file or just a plain text dump.
Quote:
Originally Posted by Salchester
Is there anyway of making the file unreadable, via storing the data as binary etc.
Do want want it written in binary or encrypted? Why? What is this file going to be used for?
Quote:
Originally Posted by Salchester
Is there anyway you could comment you code, in order for me to work out how it all works, and what values are going in to where?
The code is fully commented. The only thing I haven't commented is the actual VB functions. Google is your friend.
Quote:
Originally Posted by Salchester
is there anyway of extracting the date, with ": " before it?
You want the ":" included in the data dump? I can do that.
Quote:
Originally Posted by Salchester
What needs to be changed in the code now to ignore <Name Field> has sent the following information: and the two line breaks?
Nothing. It already does.
Quote:
Originally Posted by Salchester
Is there anyway the code can be adapted, to search the hole field, i.e. Date:, Name: Age:, with the ":"
Yes, to avoid errors when field data contains colons, we can do a search against the entire field name, but since your field name is always at the beginning of the string and always the same it's easier to do a simple character count instead. Here's your code:
vb Code:
Original - vb Code
  1. Dim sText As String
  2. Dim sDate As String
  3. Dim sName As String
  4. Dim sAge As String
  5. Dim arrText() As String
  6. Dim count As Integer
  7.  
  8. sText = text1.text
  9.  
  10. ' Get line count
  11. count = InStr(sText, vbNewLine)
  12.  
  13. ' Size our dynamic array
  14. ReDim arrText(count)
  15.  
  16. ' Split our text string into an array housing individual lines
  17. arrText = Split(sText, vbNewLine, -1, 1)
  18.  
  19. ' Pull the last 3 strings from our array, ignoring any and all before it
  20. sDate = arrText(Ubound(arrText) - 3)
  21. sName = arrText(Ubound(arrText) - 2)
  22. sAge = arrText(Ubound(arrText) - 1)
  23.  
  24. ' Parse each line for ": " followed by data entry and reassign to our variable
  25. sDate = Right(sDate, Len(sDate) - 4)
  26. sName = Right(sName, Len(sDate) - 4)
  27. sAge = Right(sAge, Len(sDate) - 3)
__________________
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.

Reply With Quote
  Trader Rating: 0 · #20  
Old January 3rd, 2007, 04:22 PM
Salchester Salchester is offline
Contributing User
Dev Hardware Newbie (0 - 499 posts)
 
Join Date: Aug 2005
Posts: 294 Salchester User rank is Corporal (100 - 500 Reputation Level)Salchester User rank is Corporal (100 - 500 Reputation Level)Salchester User rank is Corporal (100 - 500 Reputation Level)Salchester User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 23 h 37 m 7 sec
Reputation Power: 5
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!!!!

Reply With Quote
  Trader Rating: 2 · #21  
Old January 3rd, 2007, 05:29 PM
Nilpo's Avatar
Nilpo Nilpo is offline
Dev Hardware God (5000 - 5499 posts)
 
Join Date: May 2004
Location: Salem, OH
Posts: 5,404 Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)  Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 1 Month 1 Week 3 Days 19 h 42 m 53 sec
Reputation Power: 6193
Send a message via ICQ to Nilpo Send a message via AIM to Nilpo Send a message via MSN to Nilpo Send a message via Yahoo to Nilpo Send a message via Google Talk to Nilpo Send a message via Skype to Nilpo Send a message via XFire to Nilpo
MySpace Orkut
Quote:
Originally Posted by Salchester
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!!!!
I fixed all of those in my last code.

Reply With Quote
  Trader Rating: 0 · #22  
Old January 3rd, 2007, 06:51 PM
Salchester Salchester is offline
Contributing User
Dev Hardware Newbie (0 - 499 posts)
 
Join Date: Aug 2005
Posts: 294 Salchester User rank is Corporal (100 - 500 Reputation Level)Salchester User rank is Corporal (100 - 500 Reputation Level)Salchester User rank is Corporal (100 - 500 Reputation Level)Salchester User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 23 h 37 m 7 sec
Reputation Power: 5
Quote:
Originally Posted by Nilpo
I fixed all of those in my last code.
What you mean this code?

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)
Many Thanks, much appreciated!

Reply With Quote
  Trader Rating: 0 · #23  
Old January 3rd, 2007, 10:52 PM
Salchester Salchester is offline
Contributing User
Dev Hardware Newbie (0 - 499 posts)
 
Join Date: Aug 2005
Posts: 294 Salchester User rank is Corporal (100 - 500 Reputation Level)Salchester User rank is Corporal (100 - 500 Reputation Level)Salchester User rank is Corporal (100 - 500 Reputation Level)Salchester User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 23 h 37 m 7 sec
Reputation Power: 5
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.

Reply With Quote
  Trader Rating: 2 · #24  
Old January 4th, 2007, 09:22 AM
Nilpo's Avatar
Nilpo Nilpo is offline
Dev Hardware God (5000 - 5499 posts)
 
Join Date: May 2004
Location: Salem, OH
Posts: 5,404 Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)  Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 1 Month 1 Week 3 Days 19 h 42 m 53 sec
Reputation Power: 6193
Send a message via ICQ to Nilpo Send a message via AIM to Nilpo Send a message via MSN to Nilpo Send a message via Yahoo to Nilpo Send a message via Google Talk to Nilpo Send a message via Skype to Nilpo Send a message via XFire to Nilpo
MySpace Orkut
This code is working for me....show me exactly how you want your code output to look.

Reply With Quote
  Trader Rating: 0 · #25  
Old January 4th, 2007, 10:39 AM