I have an app put together that reads from a text file using streamreader. I have it coded, maybe not the best but it returns only the first line in the text file. I'm trying to get it to select a random line each time a button is pressed.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace Drug_Test_Selection
{
public partial class Form1 : Form
{
private List<string> ssn = new List<string>();
private Random rand = new Random();
public Form1()
{
InitializeComponent();
}
private void label1_Click(object sender, EventArgs e)
{
}
private void caseTxt_TextChanged(object sender, EventArgs e)
{
//holds case number informaion
}
private void resetBtn_Click(object sender, EventArgs e)
{
casePrintTxt.Clear();
oicPrintTxt.Clear();
resultsTxt.Clear();
dateTime.Clear();
caseTxt.Clear();
oicTxt.Clear();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void oicTxt_TextChanged(object sender, EventArgs e)
{
//Holds OIC information
}
private void resultsTxt_TextChanged(object sender, EventArgs e)
{
//returns the random social security number
}
private void processBtn_Click(object sender, EventArgs e)
{
using (StreamReader sr = new StreamReader(@"C:\dev\social.txt"))
resultsTxt.AppendText(sr.ReadLine());
casePrintTxt.Text = caseTxt.Text;
oicPrintTxt.Text = oicTxt.Text;
dateTime.Text = DateTime.Now.ToString();
}
}
}