|
I have a .NET 3.5 app (built using VS2008 RTM, no CTPs installed) that uses CSharpCodeProvider to compile some generated code that requires .NET 3.5. When I set the compiler's .NET version to 3.5 (per the MSDN example), I get a "csc.exe not found" exception thrown when I try to compile. Here's what I'm doing:
CompilerParameters cp = new CompilerParameters();
cp.xxx = xxx;
Dictionary<string,string> providerOptions = new Dictionary<string,string>();
providerOptions.Add ("CompilerVersion", "3.5");
CSharpCodeProvider codeProvider = new CSharpCodeProvider (providerOptions);
string sourceCode = "...";
CompilerResults cr = codeProvider.CompileAssemblyFromSource (cp, sourceCode);
If I use CSharpCodeProvider 's default constructor, the code compiles if it's .NET 2.0 compliant, but (expectedly) generates an "unknown reference" error if I try to reference a .NET 3.5 stock assembly.
A nudge in the right direction would be appreciated.
Thanks!
/ravi
|
|
|
|
|
hello..
i want to display news in the desktop application using rss feeds....
i am using the browser control but when i provide it the link of the rss feed it returns somthing like xml...plz help me about how can i display the news properly
|
|
|
|
|
Will this[^] article help?
/ravi
|
|
|
|
|
You look really young in that picture.
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
|
|
|
|
|
Thanks! I attribute my youthful appearance to years of physical inactivity, lack of exercise and furious debugging. And ham.
/ravi
|
|
|
|
|
thanks a lot thats what i wanted to learn about.thanks
|
|
|
|
|
Hello,
I've manipulated the code from this site
http://www.geekpedia.com/tutorial50_Drawing-with-Csharp.html[^], as follows at the bottom of the page, and modifying the form in the way to show scroll bars. Doing it I got some problems with scrolling.
In fact, running the form everything go well, scrolling with the bar it repaint well... But if I click on the arrow for scrolling, it doesn't repaint as well. Try to check and let me know, please, how to solve this problem.
protected override void OnPaint(PaintEventArgs e)
{
// Get the graphics object
Graphics gfx = e.Graphics;
// Create a new pen that we shall use for drawing the line
Pen myPen = new Pen(Color.PaleGoldenrod);
Pen myBPen = new Pen(Color.Goldenrod);
// Loop and create a horizontal line 10 pixels below the last one
for (int i = 0; i <= 3000; i = i + 10)
{
gfx.DrawLine(myPen, 0, i, 2990, i);
}
// Loop and create a vertical line 10 pixels next to the last one
for (int x = 0; x < 3000; x = x + 10)
{
gfx.DrawLine(myPen, x, 0, x, 2990);
}
// Loop and create horizontal line 40 pixels next to the last one
for (int z = 0; z < 3000; z = z + 40)
{
gfx.DrawLine(myBPen, 0, z, 2950, z);
}
// Loop and create a vertical line 40 pixels next to the last one
for (int zz = 0; zz < 3000; zz = zz + 40)
{
gfx.DrawLine(myBPen, zz, 0, zz, 2950);
}
}
|
|
|
|
|
What does 'not so well' mean ?
This code doesn't show any signs of responding to scrolling at all, it just draws the same thing, as far as I can see.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I apologize, I missed to say I set A.minscroll property in the form to show the scroll bar...
|
|
|
|
|
Hi everybody,
I am dabbling with Crystal reports at the moment using C# .NET 2005.
Is it possible to specify the database source at runtime?
My program dynamically creates databases at runtime and stores their location in the registry. Being able to change databases at runtime would be of massive use.
Anybody got any ideas?
Thanks
Jonathan Harker
|
|
|
|
|
If the databases have identical schema information it is fairly easy, you can loop through the Database.Tables collection and set the logon information using SetLogonInfo. If the schema is even slightly different it is PITA and I don't have the code in front of me to help.
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
|
|
|
|
|
Thanks for your quick response.
Unfortunately to complicate matters, the schemas in each table are quite different.
Jonathan Harker
|
|
|
|
|
Good luck! The documentation is sparse and can change between versions of Crystal, it can be done but the effort is not worth it. Instead set your reports to use a dataset data source and then use your application to bring the data together into an identical dataset and you will be able to use many different databases quite easily.
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
|
|
|
|
|
been experimenting with the code, come up with this so far
<br />
OleDbConnection Connection = new OleDbConnection(@"Provider=Microsoft.JET.OLEDB.4.0;data source=C:\My db.mdb;");<br />
<br />
OleDbDataAdapter adapter = new OleDbDataAdapter();<br />
<br />
DataSet ds = new DataSet();<br />
<br />
adapter.SelectCommand = new OleDbCommand("SELECT CampaignName FROM ACTIVITY", Connection);<br />
<br />
adapter.Fill(ds, "ACTIVITY");<br />
<br />
ReportDocument rd = new ReportDocument();<br />
rd.SetDataSource(ds);<br />
<br />
crystalReportViewer1.ReportSource = rd;<br />
throwing the following exception:
Invalid report file path
not exactly sure what im doing here. please advise.
Jonathan Harker
|
|
|
|
|
When you initially create the report and specify the database through the CR wizard select a file based copy of your dataset. Then at runtime use the SetDataSource method then immediately afterwards call the Refresh report method.
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
|
|
|
|
|
I have two projects that are within the same solutions. Both windows application projects.
I reference the .exe file inside my main project and now I want the referenced project to use the main projects app.config file. How can I do this?
Inside the second project (the one being referenced) I put inside it's app.config: <appsettings file="mainApp.exe.config">
I then compiled and copied the second projects compiled config file to the main projects directory, so that I can include it in the clickonce manifest.
I run the clickonce to install but when app runs it doesnt seem like it is seeing the main apps config file.
Any help would be appreciated.
Steve Welborn
Software Engineer
Inrange Consulting
|
|
|
|
|
I can't compile this code in visual studio I get an error.
Could somebody help me.
class Recurse
{
public void foo(int f)
{
Console.WriteLine("Handed "+f);
if (f < 0)
return;
if ( f % 2 == 0)
this.foo(f - 5);
else
this.foo(f + 1);
}
}
class What_Does_This_Code_Print
{
public void RunExercise()
{
Recurse recurser = new Recurse();
recurser.foo(10);
}
}
|
|
|
|
|
1) Place your code around code and pre tags so it looks nicer.
2) What error did you get?
3) Does it specify a line number?
Windows Calculator told me I will die at 28.
|
|
|
|
|
4) When is your homework due?
|
|
|
|
|
Alex501,
When you make a post, make the subject of use not "i need help", we know that already. Also, post the error you get.
Regards,
Gareth.
|
|
|
|
|
Your code is fine. Perhaps you forget to include the System namespace?
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
|
|
|
|
|
Alex501 wrote: I need help with C#
Don't we all?!? That's why we're here
Dave
|
|
|
|
|
sounds like a homework question to me.
Steve Welborn
Software Engineer
Inrange Consulting
|
|
|
|
|
Probably not as his code compiles fine
Dave
|
|
|
|
|
you sure? Tried concatenating a string and an int recently?
|
|
|
|