Computer Science

I need to write a program to solve for the following: Suppose that the file USPRES.txt contains the names fo the frist 43 United States presidents and the file USSENATE.TXT contains the names of all former and present US Senators. Write a program with nested loops that uses these files to display the names of the presidents who served in the Senate. This is for VB 2008 and here is what I have so far:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim filename As String
Dim president As String = ""
Dim sr1 As IO.StreamReader = IO.File.OpenText("C:Files.txt")
filename = sr1.ReadLine
Dim sr2 As IO.StreamReader = IO.File.OpenText(filename)
Do While (sr2.Peek <> -1)
president = sr2.ReadLine
Loop
ListBox1.Items.Add(president)

End Sub

  1. 👍 0
  2. 👎 0
  3. 👁 251

Respond to this Question

First Name

Your Response

Similar Questions

  1. Ed. Tech

    When you save documents, it is important to check the blank at the top of the navigation window to ensure you are saving your file in the correct location. A. address bar B. insert ribbon C. file type D. file name Is the answer D?

  2. Technology

    What does a file extension tell you? A. what the file is about******* B. where the file is located C. what type of file it is D. who created the file

  3. EdTech

    Why might you need to convert a file to another file type? A. It is a music or image file. B. The file is old. C. The file uses a type of software that your computer cannot open. D. The file was sent to your e-mail.

  4. C++

    // Program: name of program // Author: your name // Date Written: date you began writing the program /* Abstract: Brief description of the program */ Include in-line comments in the body of your program. You can convert

  1. computer science

    9.10: Reverse Array Write a function that accepts an int array and the array’s size as arguments. The function should create a copy of the array, except that the element values should be reversed in the copy. The function should

  2. Literature

    When you save documents, it is important to check the _____ at the top of the navigation window to ensure saving your file in the current location A.adress bar ** B.insert ribbon C.file type D.file name

  3. java

    Write a java application that finds the smallest of several integers. Prompt the user for the number of integers that will be input, then prompt the user for that number of integers. Evaluate the integers to determine the smallest

  4. computer science

    write a program that calculates a customer's monthly bill. it should input customer name, which package the customer has purchased, and how many hours were used. it should then create a bill that includes the input informtion and

  1. gtuc

    1. WRITE A PROGRAM TO CALCULATRE THE AREA OF A RECTANGLE OF LENGTH =5 CM AND BREADTH=8CM. 2. CALCULATE THE PRICE OF AN ITEM COSTING 100 GHANA CEDIS AFTER A DISCOUNT OF 10% IS APPLIED TO IT. 3. WRITE A PROGRAM TO CALCULATE THE

  2. c++

    Plzzzzzzzzzzzz Help program that produces a bar chart showing the population growth of Prairieville, a small? Write a program that produces a bar chart showing the population growth of Prairieville, a small town in the Midwest, at

  3. computer c++

    write a program that produce a bar chart showing the population growth of Prairieville, a small town in the Midwest, at 20 year intervals during the past 100 years. the program should read in the population figures (rounded to the

  4. c programming

    a student designed a program to accept the age of an employee and then compute the employees retirement year and display the same in a statement on the screen required. a) write out the pseudo-code for the program above b) write

You can view more similar questions or ask a new question.