![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#11 |
|
PFO Founder
![]() ![]() |
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 Subto 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. |
|
|
|
|
|
#12 |
|
Programming Guru
![]() ![]() |
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! |
|
|
|
|
|
#13 |
|
Programming Guru
![]() ![]() ![]() |
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." |
|
|
|
|
|
#14 | |
|
Programming Guru
![]() ![]() ![]() |
Well. That did not post correctly... but it is correct spacing in the text box.
Let me try it this way... Quote:
__________________
http://jasonpowers.net "There are a thousand hacking at the branches of evil to one who is striking at the root." |
|
|
|
|
|
|
#15 |
|
Programming Guru
![]() ![]() ![]() |
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." |
|
|
|
|
|
#16 |
|
Programming Guru
![]() ![]() ![]() |
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." |
|
|
|
|
|
#17 |
|
PFO Founder
![]() ![]() |
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. |
|
|
|
|
|
#18 |
|
Programming Guru
![]() ![]() ![]() |
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." |
|
|
|
|
|
#19 |
|
PFO Founder
![]() ![]() |
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. |
|
|
|
|
|
#20 |
|
Programming Guru
![]() ![]() ![]() |
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." |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|