Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8350141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T08:13:24+00:00 2026-06-09T08:13:24+00:00

I have this code ‘Open a file for reading ‘Get a StreamReader class that

  • 0

I have this code

'Open a file for reading
'Get a StreamReader class that can be used to read the file
Dim objStreamReader As StreamReader
Dim variableArray(20) As String
objStreamReader = File.OpenText(filePath)

'Read one line at a time
Dim someString As String
Dim variableNum As Integer = 0
'Iterate through lines
While objStreamReader.Peek() <> -1
    someString = objStreamReader.ReadLine()
    variableArray(variableNum) = someString
    variableNum = variableNum + 1
End While
For Each line As String In variableArray

Next
objStreamReader.Close()

I have a vbscript that is outputting results in a log file, appended on each line and delimited by a “|” there will only be two columns.

Here is a snippet of the VBScript code

f1.WriteLine("Server Name " & "|" & strName)
f1.WriteLine("OS Name: " & "|" & strCaption)
f1.WriteLine("OS Version: " & "|" & strVersion
f1.WriteLine("CSD Version: " & "|" & strCSDVer
f1.WriteLine("Serial Number: " & "|" & strSerial

How can I get the For Each part of my code to read this, break it apart and then create a table showing the results.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T08:13:27+00:00Added an answer on June 9, 2026 at 8:13 am

    Considering that you need two values from the variableArray in order to add a new row to the table, I would do a For..Next Loop (stepping by 2) instead of a For…Each:

    Dim myTable As New Table
    Dim loopCount As Integer
    
    For loopCount = 0 To variableNum Step 2
    
        Dim myRow As New TableRow
        Dim myCell1 As New TableCell
        Dim myCell2 As New TableCell
    
        myCell1.Text = variableArray(loopCount)
        myCell2.Text = variableArray(loopCount + 1)
        myRow.Cells.Add(myCell1)
        myRow.Cells.Add(myCell2)
        myTable.Rows.Add(myRow)
    
    Next
    

    Since you already have the amount of elements in your array stored in “variableNum”, you can just loop from 0 to that value, stepping by 2. Each iteration you’ll create two cells with the values of the current and next variables in the array. Then, those cells will be added to a row, which will in turn be added to the table.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code in a single file : public class genIntro { public
I have this code in my routes.db file: resources :users do member do get
I have this code that aggregates multiple workbooks into a preview file where all
I have this code: con.Open(); cmd = new MySqlCommand(String.Format(SELECT concat(name,'|',lastname) FROM {0} WHERE ID=
I have this code: class LFSeq: # lazy infinite sequence with new elements from
I have this code that I have written in Ruby, but when trying to
I have this code: <div class = content-dir-item> <p>Text input</p> <img src=./images/email.png class =
I have this code to create a config.ini file with Zend Framework but I
have this code: template<typename T, template<typename, typename> class OuterCont, template<typename, typename> class InnerCont, class
I have this code import com.crystaldecisions.reports.sdk.ReportClientDocument; ... ReportClientDocument rpt = new ReportClientDocument(); rpt.open(reportPath+fileName, 0);

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.