|
Not to my knowledge. I am not using LINQ.
Is there a possibility to check what framework is needed; and because of what?
I thought Visual Studio would tell me when it needs 3.5 to compile...
|
|
|
|
|
What is the original source project properties -> Application Framework setting?
|
|
|
|
|
Thats a good question. I suppose the one that created the project started with using Framework 3.5.
Could this be the reason?
|
|
|
|
|
Right click the setup project and select View->Lauch Conditions.
Click to expand the Launch Conditions in the little tree, then select .NET Framework.
In properties, you can select the Version.
|
|
|
|
|
Thank you very much Wendelldh!
You made my day! Now it works fine.
Thanks to all the other helpers.
Regards
Chris
|
|
|
|
|
Glad to finally find one I could answer. I always ask for help, but never get a chance to give a little.
Have a great day.
|
|
|
|
|
Hi,
The c# code below shows how I am executing a powershell script on the local machine.
Do you know how it can be altered so that I can do the same thing but on a remote server?
Thanks
/// <summary>
/// Runs the given powershell script and returns the script output.
/// </summary>
/// <param name="scriptText">the powershell script text to run</param>
/// <returns>output of the script</returns>
private void PowerShellExecuteAndRun(string strServer, string strScript,
out string strResult, out string strResultFull)
{
//// create Powershell runspace
Runspace runspace = RunspaceFactory.CreateRunspace();
//// open it
runspace.Open();
//// create a pipeline and feed it the script text
Pipeline pipeline = runspace.CreatePipeline();
pipeline.Commands.AddScript(strScript);
//// add an extra command to transform the script output objects into nicely formatted strings
//// remove this line to get the actual objects that the script returns. For example, the script
//// "Get-Process" returns a collection of System.Diagnostics.Process instances.
pipeline.Commands.Add("Out-String");
//// execute the script
Collection<PSObject> results = pipeline.Invoke();
//// close the runspace
runspace.Close();
//// convert the script result into a single string
StringBuilder stringBuilder = new StringBuilder();
foreach (PSObject obj in results)
{
stringBuilder.AppendLine(obj.ToString());
}
strResult = stringBuilder.ToString();
strResultFull = stringBuilder.ToString();
}
|
|
|
|
|
Hi,
I have the Class 'Buy.cs'. The method 'openBuyWindow' contains code to create and open a new Windows Form.
In the Program.cs class following code works correctly and the new Form is shown:
Buy b = new Buy();
b.openBuyWindow();
In the class Buy.cs I also have the method 'buy'. The method 'buy' calls 'openBuyWindow'. If i start the method 'buy' via threading, all procedures are done correctly, but the new Form is not shown:
Buy buy = new Buy();
Thread t1 = new Thread(new ThreadStart(buy.buy));
t1.Start();
Why?
Any suggestions appreciated
|
|
|
|
|
Just example:
...
private void button1_Click(object sender, EventArgs e)
{
Thread t = new Thread(InvokeNewForm);
t.IsBackground = true;
t.Start();
}
private void InvokeNewForm()
{
Invoke(new MethodInvoker(CreateForm));
}
private void CreateForm()
{
Form1 form1 = new Form1();
form1.Show();
}
...
|
|
|
|
|
Tank you very much, but I need to pass some parameters to my Form Object. Methodinvoker does not support this - how can I solve this problem?
|
|
|
|
|
It can be done like this
BeginInvoke(new MethodInvoker(
delegate() { method(parameters); }) );
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Tank you but somehow this won't work - BeginInvoke is not recognized from VS...
|
|
|
|
|
It works when I implement the function
private void BeginInvoke(MethodInvoker methodInvoker)
{
methodInvoker.Invoke();
}
but the form is also not shown.
For the glimpse of a second I see another window in the taskbar but it disappears almost instantly.
|
|
|
|
|
Ok I found out that when I stay in the method where the Form was created with the simple command
while (Program.buywindow_open)
{
Thread.Sleep(10);
}
the window is shown, but not responding....
|
|
|
|
|
That's because as soon as the form is shown the thread is done and so the form closes, here you're just delaying it by 10ms. What you need is the thread to not end until the form closes.
I'm no expert in threading, I know nothing apart from the principles, so treat these ideas with great caution!
You can call ShowDialog() instead of Show() as it doesn't return until the form is closed so it will stay open and be responsive, but not act as a Dialog to the form on the main thread.
void OpenBuyWindow()
{
Form form = new Form();
form.ShowDialog();
}
An ugly (maybe dangerous?) alternative is to replicate what happens in the Program.cs
void OpenBuyWindow()
{
Application.Run(new Form());
}
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Many thanks! Form.ShowDialog works!
|
|
|
|
|
gehbitte wrote: Why?
Controls (a Form is a Control) can only be operated upon by the thread that creates them, as they are not thread-safe. Controls reside in Forms, and Forms are interconnected in many ways (Parent, z-order, etc). The net result is all Controls need to be created and operated upon by the main thread only; for anything else you need to use Control.Invoke
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
I was just wondering if anybody knows how to fix the scrollbar problem with the TextBox control in WinForms. When I set ScrollBars.Horizontal, it still doesn't show up, even when the text extends the width of the textbox.
Here's the code I'm using:
t.ScrollBars = ScrollBars.Horizontal;
I've searched on Google, Bing and MSDN, but all I keep seeing are Custom TextBox control's made by other people which is not what I'm after. I'm not opposed to the idea, but all I really want is to use a simple, standard control. Has anybody had this sort of problem before?
|
|
|
|
|
It'll only work if Multiline is true and WordWrap is false.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Sorry DaveyM69 I should have also mentioned that WordWrap is false and that Multiline is also set to true. MKy bad. Thanks for your response though.
|
|
|
|
|
|
Don't make accusations based on bullshi7. I only created this account no more than an hour ago. Idiot. I have not re-posted anything, ever.
modified on Monday, July 20, 2009 9:49 AM
|
|
|
|
|
iscript wrote: Don't make accusations based on bullshi7. ... Idiot.
Nice one. You want to become popular right away?
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
I'm sorry Luc, I don't mean to offend you, or anybody for that matter, but I stand by my statement. I'm not proud of what I said, but I don't like being accused of doing something that I haven't done. I've been accused of such things in the past on other forums and won't tolerate it anymore.
I completely understand that if a message hasn't been answered right away that obviously other people don't know the answer OR don't feel like replying OR are too busy OR etc etc... Nobody on here has to give help. And I understand that.
What I don't understand is how someone could accuse me of re-posting when it obviously isn't the case.
Anyway, I think I might go and find another forum or something where I feel more relaxed and don't get accused of reposting.
|
|
|
|
|
Hi iscript,
chill out man. the reply you've got earlier probably was ill-advised. However that is no reason for name calling; we do get a lot of new members who are not familiar with the site rules, and start posting similar questions everywhere and all the time; and create several accounts for no good reasons. So we sometimes are on the defensive here.
I hope you'll get answers to your questions, and you learn to value this site, as CodeProject is a wonderful community.
Cheers.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|