Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jul 21st, 2004, 4:30 PM   #11
big_k105
PFO Founder

 
big_k105's Avatar
 
Join Date: Mar 2004
Location: Fargo, ND
Posts: 1,667
Rep Power: 10 big_k105 is on a distinguished road
Send a message via AIM to big_k105 Send a message via MSN to big_k105 Send a message via Yahoo to big_k105
see the text file route wouldnt do any good. i tryed that and it still didnt work. so that is out of the question now. but here is the way i have gottn my output to look and then i will post the code i am currently using below it

7101088 155gm1b% 0
 INPROCESS
 88059 278/ 300 162 0 06-23-04 07-16-04 07-12-04
 88543 300/ 300 0 0 07-12-04 08-02-04
 ORDERS
 96 04-07-19K BOBCAT-GWN 
 141 04-07-26K BOBCAT-GWN 
 142 04-08-02K BOBCAT-GWN 
 2 04-08-03 BOBCAT-SERV 
 133 04-08-09K BOBCAT-GWN 
 ECN FILE /u/in.dt/ecn/melg/eajcyv
 7101088 copied from 6732801
   6732801
 |------------------------------------------------------------------------------|
ADVANCED QUALITY PLANNING CHECKLIST:
 Cust:_Bobcat-Gwinner______ Used on model:______________ EAU: __________
 Similar to: __6729962___________ Eng Contact: __Chris Erickson_______
I. List any new parts required for this harness:

here is the code i use to do this

Private Sub Form_Load()
  Dim startpos As Integer, thispos As Integer
  Dim startpos2 As Integer, thispos2 As Integer
  Dim startpos3 As Integer, thispos3 As Integer
  strCommand = "/util/pninfo " + command
  s = sendCommand(strCommand)
  
  startpos = 1
  thispos = InStr(startpos, s, Chr(10))
  Do While thispos > 0
    s = Left(s, thispos - 1) & Chr(13) & Chr(10) & Mid(s, thispos + 1) ' replace chr(10) with chr(13) & chr(10)
    startpos = thispos + 2
    thispos = InStr(startpos, s, Chr(10))
  Loop

  Dim strleft As String, strright As String
  startpos2 = 1
  Do While True
    thispos2 = InStr(startpos2, s, Chr(32))
    If thispos2 = 0 Then Exit Do
    strleft = Left(s, thispos2)
    strleft = Trim(strleft)
    strright = Mid(s, thispos2 + 1)
    strright = Trim(strright)
    s = strleft & " " & strright 'replaces leading and following spaces
    startpos2 = thispos2 + 2
  Loop
  
   'replaces tabs, even tho i found out i dont need this as i dont have any tabs :D
  Dim StringPosition As Integer
  Do
    StringPosition = InStr(StringPosition + 1, s, vbTab)
    If StringPosition > 0 Then
      Mid(s, StringPosition, 1) = "   "
    End If
  Loop While StringPosition > 0
  
  txtReturned.Text = s
End Sub

to see what i want it to look like look in the first post
__________________
BIG K aka Kyle
Programming Forums
Kyle K Online

Please do not PM or email me programming questions. Post them in the forums instead.
big_k105 is offline   Reply With Quote
Old Jul 21st, 2004, 5:46 PM   #12
Pizentios
Programming Guru
 
Pizentios's Avatar
 
Join Date: May 2004
Location: Brandon, Manitoba, Canada
Posts: 2,023
Rep Power: 7 Pizentios is on a distinguished road
Send a message via ICQ to Pizentios Send a message via MSN to Pizentios
Nice, seems that you getting close to what you want.
__________________
Profanity is the one language that all programmers understand.

Check out my Blog <---updated Nov 30 2007!
Pizentios is offline   Reply With Quote
Old Jul 21st, 2004, 6:48 PM   #13
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,473
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
Alright, I wrote a little subprogram to manipulate a data file that contained the text that you posted above... here is what it outputs:

7101088 155gm1b%	0
INPROCESS
88059	278/	300	162	0	06-23-04	07-16-04	07-12-04
88543	300/	300	0	0	07-12-04	08-02-04
ORDERS
96	04-07-19K	BOBCAT-GWN	
141	04-07-26K	BOBCAT-GWN	
142	04-08-02K	BOBCAT-GWN	
2	04-08-03	BOBCAT-SERV	
133	04-08-09K	BOBCAT-GWN	
ECN	FILE	/u/in.dt/ecn/melg/eajcyv
7101088	copied	from	6732801
  6732801
|------------------------------------------------------------------------------|
ADVANCED	QUALITY	PLANNING	CHECKLIST:
Cust:_Bobcat-Gwinner______	Used	on	model:______________	EAU:	__________
Similar	to:	__6729962___________	Eng	Contact:	__Chris	Erickson_______
I.	List	any	new	parts	required	for	this	harness:


Here is the code:

Private Sub cmdGo_Click()

Dim s As String
Open "C:\code\progf\text_parser_bigk\data.txt" For Input As 1
Text1.Text = s
Do While Not EOF(1)
  Line Input #1, s
  s = Replace(s, " ", vbTab)
  
  Text1.Text = Text1.Text & vbCrLf & s
Loop
Close #1

End Sub


The main line to look at is this:

This replaces the spaces with a tab... you can incorporate the Replace function approach into your exisiting VB code more than likely. Let me know how it works out.
__________________
http://jasonpowers.net

"There are a thousand hacking at the branches of evil to one who is striking at the root."
Infinite Recursion is offline   Reply With Quote
Old Jul 21st, 2004, 6:50 PM   #14
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,473
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
Well. That did not post correctly... but it is correct spacing in the text box.
Let me try it this way...

Quote:


7101088 155gm1b% 0
INPROCESS
88059 278/ 300 162 0 06-23-04 07-16-04 07-12-04
88543 300/ 300 0 0 07-12-04 08-02-04
ORDERS
96 04-07-19K BOBCAT-GWN
141 04-07-26K BOBCAT-GWN
142 04-08-02K BOBCAT-GWN
2 04-08-03 BOBCAT-SERV
133 04-08-09K BOBCAT-GWN
ECN FILE /u/in.dt/ecn/melg/eajcyv
7101088 copied from 6732801
6732801
|------------------------------------------------------------------------------|
ADVANCED QUALITY PLANNING CHECKLIST:
Cust:_Bobcat-Gwinner______ Used on model:______________ EAU: __________
Similar to: __6729962___________ Eng Contact: __Chris Erickson_______
I. List any new parts required for this harness:
__________________
http://jasonpowers.net

"There are a thousand hacking at the branches of evil to one who is striking at the root."
Infinite Recursion is offline   Reply With Quote
Old Jul 21st, 2004, 6:57 PM   #15
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,473
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
Ok. well that didn't work... so here is a screen shot of the text box i am talking about.

http://www.geocities.com/infinite_recursio...parser_bigk.jpg
__________________
http://jasonpowers.net

"There are a thousand hacking at the branches of evil to one who is striking at the root."
Infinite Recursion is offline   Reply With Quote
Old Jul 21st, 2004, 7:01 PM   #16
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,473
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
If you have problems with that link above, right click it and copy the shortcut, then paste it into your browser. Windows sucks.

Also, the main line to look at is the one where I am using the Replace function.
__________________
http://jasonpowers.net

"There are a thousand hacking at the branches of evil to one who is striking at the root."
Infinite Recursion is offline   Reply With Quote
Old Jul 21st, 2004, 7:35 PM   #17
big_k105
PFO Founder

 
big_k105's Avatar
 
Join Date: Mar 2004
Location: Fargo, ND
Posts: 1,667
Rep Power: 10 big_k105 is on a distinguished road
Send a message via AIM to big_k105 Send a message via MSN to big_k105 Send a message via Yahoo to big_k105
sad thing is if you are using the replace function that wont work. cause im using vb5 at work and replace doesnt work in vb5 only 6

my company was to cheap to spring for vb6 but atleast they are looking into .net for us
__________________
BIG K aka Kyle
Programming Forums
Kyle K Online

Please do not PM or email me programming questions. Post them in the forums instead.
big_k105 is offline   Reply With Quote
Old Jul 21st, 2004, 8:10 PM   #18
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,473
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
You got to be kidding... lol

Well, Is the split function supported in VB5? You can probably try that.... split each line, parse the string and do a "manual" replace by overwriting character positions.
__________________
http://jasonpowers.net

"There are a thousand hacking at the branches of evil to one who is striking at the root."
Infinite Recursion is offline   Reply With Quote
Old Jul 21st, 2004, 8:22 PM   #19
big_k105
PFO Founder

 
big_k105's Avatar
 
Join Date: Mar 2004
Location: Fargo, ND
Posts: 1,667
Rep Power: 10 big_k105 is on a distinguished road
Send a message via AIM to big_k105 Send a message via MSN to big_k105 Send a message via Yahoo to big_k105
nope no slip function either
__________________
BIG K aka Kyle
Programming Forums
Kyle K Online

Please do not PM or email me programming questions. Post them in the forums instead.
big_k105 is offline   Reply With Quote
Old Jul 21st, 2004, 11:25 PM   #20
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,473
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
Now there is... merry xmas

Split - A replacement for VB6's Split function under VB5
' A replacement for the Split function under VB4 and VB5
'
' Note that the return value is a Variant that contains
' an array of strings

Function Split(ByVal Text As String, Optional ByVal Delimiter As String = " ", _
  Optional ByVal Limit As Long = -1, Optional CompareMethod As _
  VbCompareMethod = vbBinaryCompare) As Variant
  ReDim res(0 To 100) As String
  Dim resCount As Long
  Dim length As Long
  Dim startIndex As Long
  Dim endIndex As Long
  
  length = Len(Text)
  startIndex = 1
  
  Do While startIndex <= length And resCount <> Limit
    ' get the next delimiter
    endIndex = InStr(startIndex, Text, Delimiter, CompareMethod)
    If endIndex = 0 Then endIndex = length + 1
    
    ' make room in the array, if necessary
    If resCount > UBound(res) Then
      ReDim Preserve res(0 To resCount + 99) As String
    End If
    ' store the new element
    res(resCount) = Mid$(Text, startIndex, endIndex - startIndex)
    resCount = resCount + 1
    
    startIndex = endIndex + Len(Delimiter)
  Loop
  
  ' trim unused values
  ReDim Preserve res(0 To resCount - 1) As String

  ' return the array inside a Variant
  Split = res()

End Function
__________________
http://jasonpowers.net

"There are a thousand hacking at the branches of evil to one who is striking at the root."
Infinite Recursion is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 12:14 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC