|
You can't do it like that in C#, C# isn't PHP!
As Rob said, create a class representing your objects (Person?), then have a collection of instances of that class; the collection could be an Array, but most often a List is a lot handier.
|
|
|
|
|
|
DJCRIS12 wrote: as you know i want to export selected columns to an excel file, but if theres another easy way to create a report please let me know
I didn't know.
The simplest way of creating a report is by exporting it as text. The second simplest way is to export is as HTML.
Excell accepts a lot of weird formats; you could save your file as "comma separated values", as HTML/XML and as their native format. I'd recommend the CSV-version, as that would be the most simple to achieve.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
I agree with Eddy. I'd go for a CSV format because it's supported by other spreadsheet applications and requires no dependency on Excel.
If you do go with Excel also be aware that if it crashes you can start creating new instances. Unless handled properly.
Depending on where you are, you're also going to have to change the regional settings to US and back again to avoid exceptions.
"You get that on the big jobs."
|
|
|
|
|
I use ExcelLibrary which can be downloaded from Google code
License is GNU LGPL.
|
|
|
|
|
Hi This is Chandra,
working on the google maps in Asp.net with C#.At present i can able to bind the Langitude and latitude from database to Google maps based on selection of country.But, my problem is i want to bind the Sales data information along with Latitude and longitude pushpin.Is it possible? Can any one give me some suggestion on this to implements.
My table Data is looks like in the below format
Country Latitude Longitude Sales
England 51.479117 -3.178 33.32
England 51.478705 -3.177831 33.32
Thanks
Chandrkanth
|
|
|
|
|
Hi all! I had a solution to the problem i faced in my previous post below by calling Series.AddXY(). It worked. However, some of the x-axis labels are missing because of space.
Is there any way I can change the orientation of labels so that they become vertical or diagonally oriented as Excel does it? A lot of the labels have not been shown with the current solution with the labels being horizontal. Thanks.
|
|
|
|
|
Are you using a custom graph library, or is it one you've created yourself?
|
|
|
|
|
I'm using the chart library that comes with .Net Framework 4.0 in the
'System.Windows.Forms.DataVisualization.Charting' namespace.
|
|
|
|
|
This[^] might help you out then.
|
|
|
|
|
Hi everyone! I'm creating a line chart using .net framework 4. I'm a able to add points to the series which are used on the vertical axis. However, numbers are automatically assigned to the x-axis for each marker.
How do I change the numbering into my own values? The labels for the x-axis are string values and not numbers. Thanks.
modified 3-Jul-12 10:28am.
|
|
|
|
|
Hi All (especially Pete O'Hanlon),
I have now found the driver I think I am looking for the " KernelDriver,FTDIBUS,USB Serial Converter Driver" I can now check for this driver find it using the code:
ServiceController[] scDevices = ServiceController.GetDevices();
MessageBox.Show("Device driver services on the local computer");
foreach (ServiceController scTemp in scDevices)
{
lstDrivers.Items.Add(scTemp.ServiceType + "," + scTemp.ServiceName +
"," + scTemp.DisplayName);
}
I think if I can check the value of this it will do.
Pete O'Hanlon gave me some code in a question called "Correct way of doing installers"
using a Dictionary command, in copying this and trying to use it, I have obviously lost something / not understood something as the red wiggly line for syntax errors appear in System.Management. commands, I am using VS 2008 (.NET 3.5) and using System.Management only give one . option Instrumentation(?). Should I be using a Build option I have not seen before. So really the question is if I can't do it from here how can I get Petes example to work in VS 2008?
Glenn
modified 3-Jul-12 7:51am.
|
|
|
|
|
ServiceController exists in System.ServiceProcess. You need to add a reference to that.
[Edit]It's worth noting that your code is different to the example I gave, so your question doesn't make much sense if someone just reads what you've put (as I just did). This[^] is the original thread.
|
|
|
|
|
I do have that full list below (I am using 2008, .NET3.5) also
System.Management.SelectQuery query = new System.Management.SelectQuery("Win32_SystemDriver");
should get around that
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Management;
using System.ServiceProcess;
I take it the method I created will only get the name rather than anything useful. The dictionary method, I have not used much (you are only using a get method no set!) could you point me in the direction of a reasonable tutorial. A few minute job is taking so long!
Glenn
|
|
|
|
|
Have you added a reference to System.Management? It sounds like you accidentally added a reference to System.Management.Instrumentation instead.
|
|
|
|
|
Yup!
is only there as I was looking for what else was there (being nosey!) I do have
using System.Management; and
using System.ServiceProcess; any ideas.....
|
|
|
|
|
That's not what I meant by adding a reference. Right click on your project and choose Add Reference... . Scroll through the list of available .NET references and add System.Management (and System.ServiceProcess if you need it).
|
|
|
|
|
Ahh, right okay, sorry about that (too many other things, phone calls etc. got distracted from what I was (trying) to do!) the red wiggly lines have gone, been replaced by blue
on the
System.Management.ManagementObject manageObject = searcher.Get();
and the additions to the list box "driver"
driver.Add("PathName", manageObject["PathName"]);
Sorry, again I have missed something!
Glenn
|
|
|
|
|
Change the method to this:
public static Dictionary<string, string> GetDriverInfo(string driverName)
{
Dictionary<string, string> driver = new Dictionary<string, string>();
System.Management.SelectQuery query = new System.Management.SelectQuery("Win32_SystemDriver");
query.Condition = string.Format("Name='{0}'", driverName);
System.Management.ManagementObjectSearcher searcher = new System.Management.ManagementObjectSearcher(query);
foreach (System.Management.ManagementObject manageObject in searcher.Get())
{
driver.Add("PathName", manageObject["PathName"].ToString());
driver.Add("Description", manageObject["Description"].ToString());
driver.Add("State", manageObject["State"].ToString());
driver.Add("StartMode", manageObject["StartMode"].ToString());
}
return driver;
} That should do it.
|
|
|
|
|
Yayy!! the wiggly lines have gone, cue the happy dance!
(seriously) Thanks Alot!
Glenn
|
|
|
|
|
You're welcome. This is what I get when I just type code samples into the CP Message box with the famous battle cry of "this should work".
|
|
|
|
|
I now need to use the Dictionary created how can I upload the list and then search it,
if follow the reckoning I have used before would give:
driver.Add(manageObject["PathName"].ToString(),"Description",manageObject["Description"].ToString(),"State", manageObject["State"].ToString()+"StartMode",ManageObject["StartMode"].ToString());
As I in the past have done with a Dictionary
Dictionary.Add("01010", "Glenn"); and this is read out using
Console.WriteLine("myDictionary[\"01010\"]:{0}",Dictonary["01010"]);
only done it at the console!
Glenn (sorry)
modified 3-Jul-12 11:40am.
|
|
|
|
|
Right - now I'm assuming that you are using the Visual Studio installer in this example. What you do is create a custom installer step (like this[^]) and add your logic in there. Have a look here[^] for further details.
|
|
|
|
|
|
Umm, it will be caught up in an installer once it's all working, however now I would like a method of finding out about the drivers with out having to run an installer (I can see a use for it not connected to this project!)
Glenn
|
|
|
|