|
ArrayLists are reference types so by default variables are simply pointers to the same object in memory, so what you're storing is a pointer to the same array. What you want to look into is the Clone method which will return a copy of the array list, this should fix your problem.
|
|
|
|
|
Thanks A BUNCH .... u really did help me a lot thanks a lot .. i was working on it for 2 weeks thanks again
|
|
|
|
|
In solution explorer, I noticed that the Form1.Designer partial class is listed under the Form1.cs
I created some other partial class(Myclass.cs) of From1 but it doesn't appear under the Form1 in solution explorer. Is there anyway I can get it to appear under Form1.
Currently
-Form1.cs
|
----->Form1.Designer.cs
|
----->Form1.resx
...
...
MyClass.cs
Looking for
-Form1.cs
|
----->Form1.Designer.cs
|
----->Form1.resx
|
----->MyClass.cs
.....
|
|
|
|
|
Try prepending Form1 to MyClass.cs. The solution explorer tries to logically put everything together by their file name. If you write Form1.MyClass.cs, VS should see that file as a subset of your Form1 and show it in the tree as such.
|
|
|
|
|
It doesn't do that automatically, see my response to dino2094.
|
|
|
|
|
There's no way to do this automatically in VS but you can do this:
- Right click the project in the Solution Explorer and select Unload Project.
- Right click the project again in the Solution Explorer and select Edit
Project.csproj - Look for an XML element which is like
<Compile Include="MyClass.cs" /> and change it to:
<Compile Include="MyClass.cs"><DependentUpon>Form1.cs</DependentUpon></Compile> Close the project file in the editor and reload the project like in step 1, your file should now appear under the Form1 node. Note you could specify Form1.Designer.cs and it'd be displayed under that one instead.
|
|
|
|
|
I just saw myself after digging into the project file, when I couldn't repeat what I was talking about. Thank you for showing my ineptitude!
|
|
|
|
|
|
Hi! I want to know is there some in built functionality into Dot net framework which can be used to send mails thourgh Exchange Server.?
Thanks
Don't Quit
|
|
|
|
|
Could anyone tell me how to populate a javascript array using a dataset result from a database.
JT
|
|
|
|
|
You could always use RegisterStartupScript to inject some JavaScript that would do this, or you could use Ajax to control this. Personally, I would go with the Ajax route as this is a much more flexible way to do this.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Iam trying to get the log on information for a windows service.
does any body know how to get this.
I know you can use serviceinstaller to create a service and define the username and password for it.but how does one get the username for already existing service
|
|
|
|
|
Look at the service in Control Panel > Administrative Tools > Services. Select the service you want, right click it and select properties. Look under the Log on tab and you will see who it logs in as (either the local system account or the named account).
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
well iam trying to get that programatically in C#
|
|
|
|
|
Hi
Im using Microsoft Word 11.0 Component to create the word document., after completing all the process i have close all reference but still WINWORD.EXE is running in my system process.
Here is my code ....
static Word.ApplicationClass wa ;
static Word.Document wdHeader;
wa = new Word.ApplicationClass();
wdHeader = wa.Documents.Add(ref templateFile, ref missing, ref missing, ref trueObject);
wdHeader.Activate();
wa.Visible = false;
object falseObject = (object ) false ;
wdHeader.Close (ref falseObject , ref missing , ref missing );
wdHeader = null;
wa = null;
Still what i have to do to take under control since i repeat the same for 500 times then system may get crash. Please help out.
Thanks in advance...
|
|
|
|
|
My goal is to append a session id to the messages the remoting client sends out.
I have the following code in my client that adds a sink to the client channel:
BinaryClientFormatterSinkProvider provider = new BinaryClientFormatterSinkProvider();
provider.Next = new ClientSinkProvider();
IChannel chan = new TcpClientChannel("SADeskSession", provider);
ChannelServices.RegisterChannel(chan);
ClientSinkProvider is my provider class that creates a sink that implements IclientChannelSink and IMessageSink.
in the processMessage method on this sink, I have it appending something to the message's Properties object, however, the serverside sink cannot read this as it should.
I must be missing some nuance, as I am a complete novice to remoting.
Can someone put me on the right direction? I'm basing this off this article, but my needs are simple enough that I don't need classes as robust as the ones in the article.
http://www.codeproject.com/csharp/customsinks.asp
|
|
|
|
|
Hi
How can i find Windows Folder address or System32 Folder at my program
i want to copy a file in the folder for having a common security core in my Application
please help me
Masterhame
|
|
|
|
|
Masterhame wrote: How can i find Windows Folder address or System32 Folder at my program
You would use the Environment.GetFolderPath[^] method and pass it one of the Environment.SpecialFolder[^] enum values.
Masterhame wrote: want to copy a file in the folder for having a common security core in my Application
This is not recommended since it violates all sorts of security rules and won't run on Vista (or XP if someone is actually running a limited user account). Normal applications should not write to the Program Files folder, the Windows folder, or the System32 folders. (There are others as well, but these are the main three.)
Unless you will have multiple applications installed that use the same DLL, everything can be located in the application's install directory.
In any case, the only types of programs that should be writing to these folders are installers that are running with elevated privileges.
-----------------------------
In just two days, tomorrow will be yesterday.
|
|
|
|
|
Hi everyone. I have Windows.Forms.DataGrid with two columns. The first one has string values which may repeat in the column. The second one has integers. My question is how can I sum the integers where I have string values which appear in more than one row in the first column?
I need something like the "group by" clause in a sql select statement.
|
|
|
|
|
This is certainly not enough information to write your SQL statement for you. I suggest you Google SQL. There are dozens of introductory SQL pages online -- and many of the tutorials should get you where you need to go in an hour or so of study. You'll also understand SQL much better. From your question, it sounds like you *might* need an inner join -- *might*.
|
|
|
|
|
Hello Mike, I'm talking about this:
DataGrid columns
Column1 Column2
-----------------------
Month Amount
02.2007 60
02.2007 30
03.2007 50
04.2007 60
I want to add rows in the grid which sum the Amount values by Month like this:
-----------------------
02.2007 90
03.2007 50
04.2007 60
-----------------------
I need C# class not a SQL statement
|
|
|
|
|
Iterate the cells, read the values however you have to, and build your sums on whatever conditions you want to comply with. Whatever control you are using should document exactly how to do so.
|
|
|
|
|
Thanks for the help Mike.
|
|
|
|
|
You're welcome.
Incidentally, you should understand this as a basic model for what you are trying to do:
SQL is an excellent way to eliminate the conditional logic you are going to have to perform. In other words, if your source data is organized in tables (and rarely if ever is there a good reason for such data not to be -- maybe unless it's just a few values), then you can eliminate sometimes huge bodies of code and costly processes by first applying SQL to your source data. If your SQL statement can apply all the necessary conditions to reduce/filter its result set to *just* the records/rows you should be processing, then you can even get the sum in one fell swoop.
That is the ideal approach, and you should always tackle such a problem this way (even if you didn't know SQL before).
Many years ago, I discovered this in the process of re-writing a huge client/server application. The application I had to replace had gone down. No source existed. It processed a huge number of records (programmatically), finally producing billing information related to numerous categories of property acreage, altogether assembled under each owner. The first so many acres were taxed at such and such a rate, the next so many acres (per owner, not per property) were charged at further scaled rates, etc.
The original application took 3 1/2 hours to process their tables. The process was complex, and you could understand why it might take so long, particularly as substantial engineering challenges existed to any degree of refinement.
I spent the time to develop those substantial engineering innovations, and my first stab at the process processed their data in only 11 seconds. My clients practically wept they were so ecstatic.
The innovations which made the process so fast involved developing a system which never had to look at the same data twice, and elimination of all conditional processing possible -- conditional logic was reduced to the absolute minimal process.
Nonetheless, SQL tools were relatively new then (in the first days of OOP), and I had an idea that I could re-write my process -- actually eliminate most of it -- by devising an SQL statement. A few days later I demonstrated this process. Most of my time was in developing a universal interface by which they could prescribe any conceivable tax scheme in seconds. The SQL process produced billing information -- ready to print in reports -- in only 3 seconds. Moreover, the results of the prescription could be evaluated *before* application, and could be applied in 1 second to "permanent" records. The application *still* however could be reversed (unapplied) in 1 second. True story. Eyes got wet. Heads just shook. Now, for the first time ever, they could have a board meeting and decide the tax rates necessary to cover costs in seconds.
So your process takes these things into account. What is the fastest and most convenient way to do what you have to do with the resources or tools available to you?
SQL is powerful and fast. No way can you iterate your cells and produce the answer as quickly. Way back I read a benchmark that has always stuck in my head. With this certain SQL DBMS, a Pentium 90 could process a million record table and produce a [I forget just how many] many-record result set in under a second.
Think about SQL. You will use it often if you operate on data and write efficient code.
|
|
|
|
|
I had to take a look at this again -- just curious.
I don't know how you end up with a "Month" structure like this... but it looks like bad practice. Express your values as Y.M[.D], instead of M.Y. Your records will not be in chronological order -- they will be grouped by month (which is not likely to be conducive to any process, and may impose redundant overhead to practical processes).
You are citing values in each column, and the only thing I can *notice* is the lacking value in the result column is the least value, 30. You neglect to mention what your forking criteria is -- greater than or equal to 30 for instance, or greater than or equal to 50 will produce the same result set.
Now, an SQL statement can do all this in a single expression. So, do you want to spend an hour on SQL (to know that hour forever to write one SQL statement now), or do you want to write all the code to iterate cells and read and sum values?
Those are your questions.
Resist any temptation to think the latter is easier because it eliminates needing to learn SQL. For example, I don't think I've ever iterated the cells of a *data* grid (of all things) in my life -- and I would certainly question the professional credentials of anyone who ever preferred that approach over SQL.
That means a lot of other people have never iterated the cells of a *data* grid, either.
|
|
|
|