-
Jun 12th, 2018, 12:01 AM
#1
Thread Starter
Addicted Member
[RESOLVED] WPF: How to Import data from Excel to DataGrid?
Following code is okey in the WinForm Application.
http://vb.net-informations.com/datag...iew_import.htm
I need WPF version of that WinForm code.
Note: DataGridView is named DataGrid in the WPF.
-
Mar 23rd, 2020, 12:50 AM
#2
Lively Member
Re: [RESOLVED] WPF: How to Import data from Excel to DataGrid?
private void button1_Click_1(object sender, EventArgs e)
{
OpenFileDialog fdlg = new OpenFileDialog();
fdlg.Title = "Select file";
fdlg.InitialDirectory = @"c:";
fdlg.FileName = txtFileName.Text;
fdlg.Filter = "Excel Sheet(*.xls)|*.xls|All Files(*.*)|*.*";
fdlg.FilterIndex = 1;
fdlg.RestoreDirectory = true;
if (fdlg.ShowDialog() == DialogResult.OK)
{
txtFileName.Text = fdlg.FileName;
Import();
Application.DoEvents();
}
}
-
Mar 23rd, 2020, 12:51 AM
#3
Lively Member
Re: [RESOLVED] WPF: How to Import data from Excel to DataGrid?
private void button1_Click_1(object sender, EventArgs e)
{
OpenFileDialog fdlg = new OpenFileDialog();
fdlg.Title = "Select file";
fdlg.InitialDirectory = @"c:";
fdlg.FileName = txtFileName.Text;
fdlg.Filter = "Excel Sheet(*.xls)|*.xls|All Files(*.*)|*.*";
fdlg.FilterIndex = 1;
fdlg.RestoreDirectory = true;
if (fdlg.ShowDialog() == DialogResult.OK)
{
txtFileName.Text = fdlg.FileName;
Import();
Application.DoEvents();
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|