|
I don't know Python, and I guess I don't want to.
C# 4.0 has dynamic, but I've only seen a small demo of it, so I really can't say. I expect it will be abused as well.
|
|
|
|
|
Luc Pattyn wrote: Right. I haven't used var
Me too. But, I use the auto (equivalent for var introduced in C++0x) keyword extensively in C++ and it makes the code more readable.
|
|
|
|
|
Hi all,
Please help me with your ideas
From c#.net application how to perform scan operation using twain protocol?
thanks
|
|
|
|
|
The first result[^] of a google search[^], finds one on this very site. I'm sure many of the other 257000 results may prove fruitful too.
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)
|
|
|
|
|
this C header[^] file may prove useful.
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)
|
|
|
|
|
My C# compiler most strongly objects
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 know the feeling - I've still got a little more work to do on my MIDI wrapper, and most of the implementation has come from studying the relevant C header file rather than relying on stuff on PInvoke.net (which can be useful, but occaisionally just plain wrong) etc. It made my brain hurt - lots, which is why it's not finished yet!
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)
|
|
|
|
|
Hi,
i can read a excel File but i can´t populate it on a datagrid. Can somebody help me?
That´s my code:
private void button1_Click(object sender, EventArgs e)
{
this.openFileDialog1.FileName = "*.xls";
if (this.openFileDialog1.ShowDialog() == DialogResult.OK)
{
ApplicationClass xlApplication = new ApplicationClass();
Workbook xlWorkbook = null;
Worksheet xlWorksheet = null;
Range xlRange = null;
xlApplication.Visible = false;
xlApplication.ScreenUpdating = false;
xlApplication.DisplayAlerts = false;
string workbook = this.openFileDialog1.FileName;
xlWorkbook = xlApplication.Workbooks.Open(openFileDialog1.FileName, 0, true, 5, "", "", true, XlPlatform.xlWindows, "\t", false, false, 0, true, 0, false);
xlWorksheet = (Worksheet)xlWorkbook.Worksheets[1];
}
}
Now, how can i report this excel in my datagrid?
Thanks
|
|
|
|
|
Well you are on the right track.
What you have to do now is loop through the worksheet and populate a DataTable.
This can be a real pain in the ass if you don't know the "Schema" of the Worksheet.
If you know the last cell and column that data is in you can just loop through it and add new rows to the DataTable. If you don't know the last cell and column, this is where it's a pain in the ass, you have to look for them.
Once you have the data in a DataTable, just set the DataSource of your grid to the DataTable.
You can find a little bit more info on how to properly read excel here[^].
JUST REMEMBER when working with excel you actually have to loop through each open workbook / sheet and close them, pass the parameters for saving, to actually kill excel otherwise it just sits in the background taking up precious resources.
If at first you don't succeed ... post it on The Code Project and Pray.
|
|
|
|
|
You can also use SpecialCells[Excel.XlCellType.xlCellTypeLastCell] to get the last cell.
This returns a crll which will have the last row and last column.
I beleive it just finds the last one with data.
I believe it is a member of the worksheet class.
|
|
|
|
|
Hey thats great news .... where were you a few years back when I really needed that.
If at first you don't succeed ... post it on The Code Project and Pray.
|
|
|
|
|
Hi all,
I am getting the error after performing LPR on 10 jobs
"A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond"
please help me...
|
|
|
|
|
Hi,
i am developing an application in Visual Studio 2008.
My Destination Framework - Setting is set to ".Net Framework 2.0"; I do not need special functions of .Net 3.5 and I want the tool installed as quick and easy as possible.
I am using the Built-In "Setup Project" to install my application.
The problem now is that When only including .Net Framework 2.0 in my installation package, the installer says it need .Net Framework 3.5. How can this happen?
If not really needed I want to keep using the 'old' Framwork 2.0.
Regards,
Chris
|
|
|
|
|
Check your project properties. What does the Application ->Target Framework say?
If that still says .NET Framework 3.5, then you know why its not using 2.0
|
|
|
|
|
This is the strange thing! I selected .Net Framework 2.0. But even in the begining when creating the setup Project it wants to include .Net Framework 3.5. I deselected 3.5 and selected 2.0.
On another machine where i tried the setup process, a message told me that 3.5 is needed and can be downloaded online.
|
|
|
|
|
Right click the setup solution on the solution explorer. At the bottom there is a "prerequisite" button. Make sure that the 3.5 Framework and 3.5 Framework SP1 are deselected. Maybe that will fix it.
|
|
|
|
|
This is where i delesected .NetFramwork 3.5 and only selected .NetFramwork 2.0.
|
|
|
|
|
Are you using any features that are only available in 3.5? LINQ for instance
|
|
|
|
|
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();
}
|
|
|
|