Click here to Skip to main content
15,907,281 members
Home / Discussions / C#
   

C#

 
GeneralRe: Good Example C# Datagrid and CRUD-Functionality Pin
gpc4413-Jan-16 2:41
gpc4413-Jan-16 2:41 
QuestionThe best way to set all the datagrid cells of a row with the same value Pin
Member 1144944711-Jan-16 8:03
Member 1144944711-Jan-16 8:03 
AnswerRe: The best way to set all the datagrid cells of a row with the same value Pin
John Torjo11-Jan-16 13:59
professionalJohn Torjo11-Jan-16 13:59 
GeneralRe: The best way to set all the datagrid cells of a row with the same value Pin
Member 1144944711-Jan-16 22:49
Member 1144944711-Jan-16 22:49 
GeneralRe: The best way to set all the datagrid cells of a row with the same value Pin
John Torjo11-Jan-16 23:36
professionalJohn Torjo11-Jan-16 23:36 
AnswerRe: The best way to set all the datagrid cells of a row with the same value Pin
Pete O'Hanlon12-Jan-16 1:08
mvePete O'Hanlon12-Jan-16 1:08 
GeneralRe: The best way to set all the datagrid cells of a row with the same value Pin
Member 1144944712-Jan-16 1:33
Member 1144944712-Jan-16 1:33 
GeneralRe: The best way to set all the datagrid cells of a row with the same value Pin
Pete O'Hanlon12-Jan-16 2:01
mvePete O'Hanlon12-Jan-16 2:01 
GeneralRe: The best way to set all the datagrid cells of a row with the same value Pin
Member 1144944712-Jan-16 3:09
Member 1144944712-Jan-16 3:09 
GeneralRe: The best way to set all the datagrid cells of a row with the same value Pin
Pete O'Hanlon12-Jan-16 3:12
mvePete O'Hanlon12-Jan-16 3:12 
Questiondtsearch engine/desktop C#? Pin
Hossei_Da_Hustla11-Jan-16 5:40
Hossei_Da_Hustla11-Jan-16 5:40 
AnswerRe: dtsearch engine/desktop C#? Pin
OriginalGriff11-Jan-16 5:52
mveOriginalGriff11-Jan-16 5:52 
AnswerRe: dtsearch engine/desktop C#? Pin
Richard Deeming11-Jan-16 5:58
mveRichard Deeming11-Jan-16 5:58 
QuestionReport Builder in Visual Studio Pin
milo-xml11-Jan-16 3:11
professionalmilo-xml11-Jan-16 3:11 
GeneralRe: Report Builder in Visual Studio Pin
V.11-Jan-16 3:40
professionalV.11-Jan-16 3:40 
GeneralRe: Report Builder in Visual Studio Pin
milo-xml11-Jan-16 4:54
professionalmilo-xml11-Jan-16 4:54 
AnswerRe: Report Builder in Visual Studio Pin
V.11-Jan-16 19:59
professionalV.11-Jan-16 19:59 
GeneralRe: Report Builder in Visual Studio Pin
milo-xml12-Jan-16 1:27
professionalmilo-xml12-Jan-16 1:27 
AnswerRe: Report Builder in Visual Studio Pin
Gerry Schmitz11-Jan-16 4:54
mveGerry Schmitz11-Jan-16 4:54 
GeneralRe: Report Builder in Visual Studio Pin
milo-xml11-Jan-16 5:08
professionalmilo-xml11-Jan-16 5:08 
GeneralRe: Report Builder in Visual Studio Pin
Gerry Schmitz11-Jan-16 5:29
mveGerry Schmitz11-Jan-16 5:29 
AnswerRe: Report Builder in Visual Studio Pin
Mycroft Holmes11-Jan-16 12:04
professionalMycroft Holmes11-Jan-16 12:04 
QuestionC# Run Powershell with elevated rights Pin
Member 1085106210-Jan-16 15:06
Member 1085106210-Jan-16 15:06 
Apologies if this has been answered before.

I have a C# program that calls various PowerShell scripts as it runs. If I run the program as an administrator, it doesn't seem to pass on the elevated rights to the runspaces used for executing the scripts.

Is there any way to do this? The code I am using to run the scripts is below:

C#
string mScriptPath = "Project.Resources." + mScriptName + ".ps1";
                Assembly _assembly = Assembly.GetExecutingAssembly();
                StreamReader _psStreamReader = new StreamReader(_assembly.GetManifestResourceStream(mScriptPath));

                Runspace runspace = RunspaceFactory.CreateRunspace();
                runspace.Open();
                string powerShell = _psStreamReader.ReadToEnd();
                _psStreamReader.Close();
                var shell = PowerShell.Create();
                shell.Commands.AddScript(powerShell);
                shell.Invoke();


Any help would be appreciated
AnswerRe: C# Run Powershell with elevated rights Pin
Garth J Lancaster10-Jan-16 16:54
professionalGarth J Lancaster10-Jan-16 16:54 
QuestionMemory leak trouble with Linq to Sql and multiple threads Pin
JD869-Jan-16 14:07
JD869-Jan-16 14:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.