TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Hesham Hassanein
NA
140
17k
Passing paramters from event handler to another function
Oct 7 2016 10:50 AM
How can i pass a var parameter from event handler to another function
I am watching a directory and doing an event handler when file is created go to the function ReadData. So how can i pass the values of tempfilepath and fileName to ReadData function?. thanks in advance
static
void
OnCreated(
object
source, FileSystemEventArgs e)
{
int
P_Count = 0;
// Specify what is done when a file is created
Console.WriteLine(
"File: "
+ e.FullPath +
" "
+ e.ChangeType);
SomeGlobalVariables.fileName = e.FullPath;
SomeGlobalVariables.counter++;
string
[] fileArray =
new
string
[SomeGlobalVariables.counter];
for
(
int
count = 0; count <= fileArray.Length - 1; count++)
{
fileArray[count] = SomeGlobalVariables.fileName;
SomeGlobalVariables.filenameslist.Add(fileArray[count]);
P_Count = P_Count + 1;
// Number of added files
Console.WriteLine (
"Number of Files in the list = "
+ P_Count);
foreach
(var filenames
in
SomeGlobalVariables.filenameslist)
{
var fileName = filenames;
var Name_File = Path.GetFileName(fileName);
var tempfilepath = (@
"C:\Users\" + Name_File + "
.CSV");
}
}
static
void
ReadData()
{
using
(System.IO.StreamWriter tempfile =
new
System.IO.StreamWriter(tempfilepath))
{
System.IO.StreamReader reader =
new
System.IO.StreamReader(fileName);
}}
Reply
Answers (
3
)
i can not edit update delete in gridview in asp.net c#
create ios, android,windows And web application in xamarin