hey there, I have I textbox to display the browse file path, 2combobox drop down containing the month and the year. I need to upload excel file to a folder within the project and perform checking to ensure that the month and year selected exists in excel file. In the excel file, dates are jumble up. Help is most appreciated.
Thanks
Loading
Nur dianaPosted Feb 6, 2012, 7:46 AM
Satyapriya NayakPosted Feb 6, 2012, 5:49 AM
Try this for upload excel files in windows.
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 File_upload
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void btn_upload_Click(object sender, EventArgs e)
{
OpenFileDialog op1 = new OpenFileDialog();
op1.Multiselect = true;
op1.ShowDialog();
op1.Filter = "allfiles|*.xls";
textBox1.Text = op1.FileName;
int count = 0;
string[] FName;
foreach (string s in op1.FileNames)
{
FName = s.Split('\\');
File.Copy(s, "C:\\file\\" + FName[FName.Length - 1]);
count++;
}
MessageBox.Show(Convert.ToString(count) + " File(s) copied");
}
}
}
Thanks