Click here to Skip to main content
15,891,033 members
Home / Discussions / Visual Basic
   

Visual Basic

 
Questionstocks in rss or xml (or hell, text if nothing else) Pin
medicenpringles16-Oct-05 13:28
medicenpringles16-Oct-05 13:28 
AnswerRe: stocks in rss or xml (or hell, text if nothing else) Pin
Christian Graus16-Oct-05 13:35
protectorChristian Graus16-Oct-05 13:35 
QuestionAt Window Startup....'System.TypeInitializationException' thrown Pin
militiaware16-Oct-05 13:09
militiaware16-Oct-05 13:09 
QuestionHow to program a 9X9 databox Pin
iam4ed16-Oct-05 10:55
iam4ed16-Oct-05 10:55 
AnswerRe: How to program a 9X9 databox Pin
Christian Graus16-Oct-05 13:26
protectorChristian Graus16-Oct-05 13:26 
GeneralRe: How to program a 9X9 databox Pin
iam4ed17-Oct-05 10:14
iam4ed17-Oct-05 10:14 
GeneralRe: How to program a 9X9 databox Pin
Christian Graus17-Oct-05 12:12
protectorChristian Graus17-Oct-05 12:12 
Questioncan someone help me figure out how to read this text delimited file Pin
tonyonlinux16-Oct-05 10:46
tonyonlinux16-Oct-05 10:46 
I have a file that is delimited by tabs and for the life of me can't figure out how to get my program to work correctly because the p 12 box 1 and so forth is not on every single line. If you could please take the time and help me that would be great.
Here is the code i have so far.
[code]
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim readpath As String = txtRead.Text.ToString()
Dim writepath As String = txtWrite.Text.ToString()
Dim sr As New StreamReader(readpath)
Dim line As String
Dim linevalues() As String
Dim contents As New ArrayList


Dim finished As Boolean = False

While Not finished
line = sr.Readline()
If line Is Nothing Then
finished = True
Else
linevalues = Split(line, TAB().ToString())
contents.Add(linevalues)

End If

End While
Dim sw As New StreamWriter(writepath)
Dim counter As Integer
For counter = 0 To contents.Count() - 1
linevalues = CType(contents(counter), String())
If linevalues(3) = "ACA" Then
' Write all information for ACA type meter
Call sw.WriteLine(TAB().ToString() & "3 " & TAB().ToString() & linevalues(2) & TAB().ToString() & linevalues(3) & linevalues(4) & TAB().ToString() & linevalues(5) & "100" & TAB().ToString() & "Single Phase" & TAB().ToString() & "FORM-2 BASE-S VOLT-240 TA-30 Kh-7.2 RR-13 8/9 Wire " & "Shipment4 " & "Accurae Calibration of the Carolinas" & linevalues(0) & linevalues(1) & linevalues(2) & TAB().ToString() & TAB().ToString() & TAB.ToString() & "0" & TAB().ToString() & "6" & TAB.ToString() & "100" & TAB.ToString() & "Z" & TAB.ToString() & "1" & TAB().ToString() & "8" & TAB().ToString() & " Radio Read" & TAB().ToString() & "10/10/05" & linevalues(6) & TAB().ToString() & linevalues(7) & TAB().ToString() & linevalues(8) & TAB().ToString() & linevalues(9) & TAB().ToString() & linevalues(10) & TAB().ToString() & linevalues(11))
ElseIf linevalues(3) = "ACD" Then
' Write all information for ACD type meter
Call sw.WriteLine("," & "3," & linevalues(1) & linevalues(2) & "," & linevalues(3) & ",,,Shipment 3,Langus Meter,1,Langus," & linevalues(4) & "," & linevalues(5) & "," & linevalues(6) & "," & linevalues(7))
ElseIf linevalues(3) = "ACG" Then
' Write all information for ACG type meter
Call sw.WriteLine("," & "3," & linevalues(1) & linevalues(2) & "," & linevalues(3) & ",,,Shipment 3,GE Meter,1,GE," & linevalues(4) & "," & linevalues(5) & "," & linevalues(6) & "," & linevalues(7))
End If


'Call sw.WriteLine(linevalues(0) & " whatever ")

Next
sr.Close()
sw.Close()
lblFinished.Visible = True
End Sub
[/code]

Here is a sample of the text file

[code]
P 12 1 ACA 26732042 50013209 100.09 99.73 100.09 99.73 100.02 100.02
ACA 26729748 50013043 99.31 98.82 99.84 100.13 99.22 99.90
ACA 26730218 50010533 100.02 99.59 100.02 99.59 99.94 99.94
ACA 26664336 50010599 99.88 100.13 99.88 100.13 99.93 99.93

P 12 2 ACA 27267998 50013354 99.92 98.61 100.13 99.75 99.66 100.05
ACA 38623886 50013351 100.03 99.76 100.03 99.76 99.98 99.98
ACA 26727768 50010624 99.77 99.30 99.97 100.29 99.68 100.03
ACA 27638050 50010558 100.20 100.03 100.20 100.03 100.17 100.17

P 12 3 ACA 38623828 50013238 99.93 99.47 100.02 100.21 99.84 100.06
ACA 39181977 50013338 100.11 99.93 100.11 99.93 100.07 100.07
ACA 39254044 50013227 99.99 99.83 99.99 99.83 99.96 99.96
ACA 38661916 50010577 99.93 99.48 99.92 99.71 99.84 99.88
[/code]

for an aca it needs to write to the file for example the following

tab() 3 tab() ACA26732042 tab() 500013209 tab() 100 tab() Single Phase tab() Form-2 Base-S Volt-240 TA-30 kh-7.2 RR-13 8/9 Wire tab() shipment4 tab() Accurate Calibration of the Carolinas & tab() P 12 1 tab() tab() tab() 0 tab() 6 tab() 100 tab() Z tab() 1 tab() 8 tab() Radio Read tab() 10/10/05 tab() 100.09 tab() 99.73 tab() 100.09 tab() 99.73 tab() 100.02 tab() 100.02

please note tab() indicates that it needs to be tab delimited.

Thankks for your help.
Tony
QuestionHow To... Volume control in VB.net, effects system volume? Pin
fitzmarcade16-Oct-05 4:28
fitzmarcade16-Oct-05 4:28 
AnswerRe: How To... Volume control in VB.net, effects system volume? Pin
AndrewVos16-Oct-05 19:20
AndrewVos16-Oct-05 19:20 
GeneralRe: How To... Volume control in VB.net, effects system volume? Pin
fitzmarcade17-Oct-05 3:50
fitzmarcade17-Oct-05 3:50 
AnswerRe: How To... Volume control in VB.net, effects system volume? Pin
Jerry___21-Oct-05 1:37
Jerry___21-Oct-05 1:37 
Questionconverting sql info enumerator code. Pin
abhinish15-Oct-05 21:31
abhinish15-Oct-05 21:31 
AnswerRe: converting sql info enumerator code. Pin
Christian Graus16-Oct-05 13:35
protectorChristian Graus16-Oct-05 13:35 
Questionperformance .. URGENT Pin
15-Oct-05 21:24
suss15-Oct-05 21:24 
Questionperformance .. URGENT Pin
Amalarajan15-Oct-05 21:23
Amalarajan15-Oct-05 21:23 
AnswerRe: performance .. URGENT Pin
Christian Graus16-Oct-05 13:27
protectorChristian Graus16-Oct-05 13:27 
GeneralRe: performance .. URGENT Pin
Amalarajan18-Oct-05 1:19
Amalarajan18-Oct-05 1:19 
GeneralRe: performance .. URGENT Pin
Christian Graus18-Oct-05 11:54
protectorChristian Graus18-Oct-05 11:54 
GeneralRe: it Works.. URGENT Pin
Amalarajan20-Oct-05 8:04
Amalarajan20-Oct-05 8:04 
GeneralRe: it Works.. URGENT Pin
Christian Graus20-Oct-05 10:03
protectorChristian Graus20-Oct-05 10:03 
QuestionRemoving Handler... URGENT Pin
Shubhabrata Mohanty15-Oct-05 16:14
Shubhabrata Mohanty15-Oct-05 16:14 
AnswerRe: Removing Handler... URGENT Pin
S. Senthil Kumar15-Oct-05 23:33
S. Senthil Kumar15-Oct-05 23:33 
GeneralRe: Removing Handler... URGENT Pin
Shubhabrata Mohanty16-Oct-05 10:39
Shubhabrata Mohanty16-Oct-05 10:39 
QuestionTransparent Text lable without showing form Pin
Member 230469115-Oct-05 16:05
Member 230469115-Oct-05 16:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.