Previous
Next..
Here i will explain How to use OpenFile Dialog and Copy that path.
Step(1):Form
Drag and down a button and write its text as "Open".
Step(2):Code
Double click on button and write this code.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace First_Csharp_app
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Button1_click(object sender, EventArgs e)
{
OpenFileDialog openfile = new OpenFileDialog ();
if(openfile .ShowDialog() ==System.Window.Forms.DialogResult.OK)
{
string strfilename = openfile .FileName;
MessageBox.show(strfilename);
}
}
Step(3):Output
Now run your application.
Previous
Next..