I read tons of threads in the stackoverflow and nobody has a clear answer, or just the answer, to how to get a user name in the C# code. VFP does it very simply. So, VFP is much better than C#. The only thing I like in C# is a compiler which checks the syntax and if a variable is used and how. Otherwise, VFP is better.
I did think about writing the value in a txt file and then reading it from the C# code. But then I have to make sure that each txt file has a unique name (so that there is no conflict). And then delete the txt file.
There has to be a way to return a value from a VFP exe. But if there is none, then writing to a txt file will be the approach.
Thank you.
>There's got to be a way to do this cleanly within C#, without needing to resort to this VFP kludge. I don't know the answer but it can't be that hard.
>
>If you really want to be enabled for this bad idea, you could write the value to a file with STRTOFILE() and then read it from C#.
>
>>Hi,
>>
>>I need to call a small VFP .EXE from a C#/.NET code. The VFP project has one .PRG with has just one line:
>>
>>RETURN (GetEnv("UserName"))
>>
>>
>>How do I call this .EXE from C# code?
>>
>>I called VFP EXE in my C# code before using the Proc syntax. Example:
>>
>>Process Proc = Process.Start(cVfpExeFullPath, "1");
>>
>>
>>But before my VFP EXE didn't have to return anything. So, it was simple.
>>
>>Now I want the VFP EXE to return a value and capture this value in the C# code.
>>
>>How?
>>
>>TIA
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham