Click here to Skip to main content
15,879,326 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
from
Abhijit
Posted

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:
C#
private void butOpenCV_Click(object sender, EventArgs e)
    {
    string cvToOpen = @"D:\Temp\ThisBlokesCV.docx";
    Process.Start(cvToOpen);
    }

If you want to open it into your application, then we would need more information.
 
Share this answer
 
Comments
16041984 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 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");

//myProc.CloseMainWindow();

}
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.
how????
OriginalGriff 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");
or
string[] files = Directory.GetFiles(@"D:\Temp", "CANDIDATE000003*.docx");


16041984 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 name.how can i identify this?
OriginalGriff 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.?
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);

}
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900