Write a program that asks the user to enter the name of a file. The program should display the number of characters in the file.
1
Expert's answer
2016-06-17T04:43:42-0400
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.IO;
namespace FInfo { public partial class Form1 : Form { public Form1() { InitializeComponent(); }
/// <summary>Open file</summary> private void btn_Open_Click(object sender, EventArgs e) { //Open file or return if 'Cancel' pressed if (openFileDialogMain.ShowDialog() == System.Windows.Forms.DialogResult.Cancel) return;
//Print file name txt_File.Text = "File: " + openFileDialogMain.FileName;
//Counting and print the number of characters FileInfo Inf = new FileInfo(openFileDialogMain.FileName); txt_Number.Text = "Number of characters: " + Inf.Length.ToString(); } } }
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
Comments
Leave a comment