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 6696607
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:21:41+00:00 2026-05-26T06:21:41+00:00

So I feel like im pretty close, but I also have a feeling I

  • 0

So I feel like im pretty close, but I also have a feeling I am mixing up StreamReader and ReadAllLines

…………………………………………………………………………

Option Strict On

Imports System.IO

Public Class Form4

Dim file As System.IO.StreamWriter

Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    file = My.Computer.FileSystem.OpenTextFileWriter("c:\devices.bat", False)
    file.WriteLine("@echo off")
    file.WriteLine("cd " & Form1.TextBox2.Text)
    file.WriteLine("adb devices > C:\devices.txt")
    file.Close()
    Shell("C:\devices.bat", AppWinStyle.Hide, True, 500)

    Dim output() = System.IO.File.ReadAllLines("C:\deviceinfo2.txt")
    Dim Devices As String = ""
    Dim line() As String = {}

    For X = 1 To output.Count = -1
        line = output(X).Split(New Char() {("     ")})
        Devices = line(0)
        ComboBox1.Items.Add(Devices)

    Next

    output.Close()
    output.Dispose()

End Sub

End Class

………………………………………………………………

What I am trying to have it do is to start reading on line two of devices.txt and then read the first word from each line until the text file is done.

It seems simple enough, but like I said, I think I am mixing streamreader with readalllines

Any help is appreciated

  • 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-05-26T06:21:42+00:00Added an answer on May 26, 2026 at 6:21 am
    Class Test
        Public Sub Main()
            Try
                ' Create an instance of StreamReader to read from a file.
                ' The using statement also closes the StreamReader.
                Using sr As New StreamReader("TestFile.txt")
                    Dim line, firstWord As String
                    Dim i as Integer = 0
                    ' Read and display lines from the file until the end of
                    ' the file is reached.
                    Do
                        line = sr.ReadLine()
                        If Not (line Is Nothing) AndAlso i > 0 Then
                             firstWord = line.Split(" ")(i)
                            'do your logic
                        End If
                        i += 1
                    Loop Until line Is Nothing
                End Using
            Catch e As Exception
                ' Let the user know what went wrong.
            End Try
        End Sub
    End Class
    

    Grabbed this from MSDN and modified it. It should compile, but I didn’t test it. This will loop through the lines, 1 by 1, skip the first line and grab each line’s first word after. Hope this helps.

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

Sidebar

Related Questions

I am pretty new to Haskell but I feel like I have a decent
I feel like there's a pretty simple way to do this, but I'm not
I feel like this question has been asked before but the answers seem pretty
I feel like I have a pretty good handle on pointers in C. Mostly,
I feel like this is a pretty common problem but I wasn't really sure
I feel like this is probably a pretty dumb question, but I am just
I have a pretty common case for nested routes, I feel like, that looks
Feeling pretty brain-dead right now. I can, of course, brute-force this, but I feel
I feel like such a noob asking this but, for some reason a horizontal
I feel like I've only ever seen this here on SO, but I can't

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.