Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: C#3.5
In windows form application in .net I want to open a CV file of a perticular person from folder on C:. in order to do that i kept a link button on gridview but i'am not getting how to write the code for that button can any one help me for that
thanks and regards
Posted 7-Aug-12 0:07am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

How you write it depends on what you mean by "open a CV file"
If you have it as a Word document for example, then you would just use Process.Start:
private void butOpenCV_Click(object sender, EventArgs e)
    string cvToOpen = @"D:\Temp\ThisBlokesCV.docx";
If you want to open it into your application, then we would need more information.
16041984 at 7-Aug-12 5:31am
but how can i find cv of a perticular person from folder.i have cv of 100 candidate and when i click on gridview link button i want to display cv of a search candidate????? i want to open it in my application
16041984 at 7-Aug-12 5:38am
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)

if (e.ColumnIndex == 0)
Process myProc;
myProc = Process.Start("C:\\Resumeupload\\employee.docx");


i use that code but it opens employee.docx on each click of datagridview link..i want to open a cv of a search candidate.
OriginalGriff at 7-Aug-12 5:43am
Either you have a reference to the candidate in some form of database, with yout otehr information on him, or you need to store them under some unique name you can refer to. Then you can use Directory.GetFiles with the appropriate search pattern:
string[] files = Directory.GetFiles(@"D:\Temp", "*.docx");
string[] files = Directory.GetFiles(@"D:\Temp", "CANDIDATE000003*.docx");

16041984 at 7-Aug-12 6:15am
but on input form add the time of save i have browse button and user have n number of cv with different can i identify this?
OriginalGriff at 7-Aug-12 6:36am
You will have to keep a record yourself, of which CV belongs to which candidate!
The computer can't tell - you have to decide and store that somewhere.
Where are you storing other candidate info - his name, phone, en=mail, town, etc.?
16041984 at 7-Aug-12 6:40am
thats right i save in database.but how can i pick from database dynamicaly or from folder.any idea?? i am newbie
OriginalGriff at 7-Aug-12 6:59am
The way I do it (not with CV's but with general documents) is to keep a link to the file in a database table, with a version number, and an insert date, with a link to the user concerned. You then do an SQL query on UserID, and latest version which gives you a link to the file.
However, if you are keeping a database of users, then you shouldn't store the files on a specific machine - it would work better as a network share, so that more than one person can access them.
16041984 at 16-Aug-12 7:53am
thx dear
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
DataGridViewRowCollection rows = dataGridView1.Rows;
int selectedvalue = e.RowIndex;
string path = "";
for (int j = 0; j < rows.Count; j++)
if (selectedvalue == rows[j].Index)
for (int k = 0; k < rows[j].Cells.Count; k++)
DataGridViewColumn name = rows[j].Cells[k].OwningColumn;
if (name.Name.Equals("CV_Destination"))
path = rows[j].Cells[k].Value.ToString();
//StreamReader objreader = new StreamReader(dataGridView1.Rows);
Process myProc;
myProc = Process.Start(path);

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 304
1 Sergey Alexandrovich Kryukov 255
2 Shweta N Mishra 216
3 Maciej Los 210
4 PIEBALDconsult 184
0 OriginalGriff 7,630
1 Sergey Alexandrovich Kryukov 7,022
2 DamithSL 5,586
3 Manas Bhardwaj 4,946
4 Maciej Los 4,525

Advertise | Privacy | Mobile
Web01 | 2.8.1411023.1 | Last Updated 3 Sep 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100