jmkotman
asked on
Open File Dialog Box to Open Text File
Below i have attached code, i would like to make it so that when that method is called it brings up a dialog box to open a file rather then hard coding the file name in there. how would i do that?
FileStream UserRead = new FileStream("A1 UserTransFile a-z.txt", FileMode.OpenOrCreate, FileAccess.Read, FileShare.None);
StreamReader ReadUser = new StreamReader(UserRead);
Transactions = 0;
data = "";
data = ReadUser.ReadLine();//read in line of data
while (data != null)
{
if (data == "P")//if process key is P, go to print
{
NodeCount = 0;
WriteToLog.WriteLine("P:");//Write transaction P to log
Print(rootPtr);//call print
WriteToLog.WriteLine();
WriteToLog.WriteLine();
Transactions++;
}
else
{
MethodCall = "Q";
Query();
Transactions++;
}
data = ReadUser.ReadLine();//read in next line of data
}
//write transaction to log file
WriteToLog.WriteLine("*Process BST done: {0} transactions done", Transactions.ToString("d2"));
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Sory Jim, I didnt see your post. :(
Open in new window