|
|
Ok, good. Please do think about this though. As I tried to point out (and others with me), this might not be a good solution even if it is doable. Thinking a bit ahead I do see problems wth deployment and that this creates an unattractive dependency between projects.
//daniel
|
|
|
|
|
This seems like one of those things which is a bit hard because you shouldn't be doing it. I see a few scenarios where you might think you want this, and an answer to each of them.
- The two tasks are part of one overall task, which is to create the files and then work on them.
- Solution: make them both part of the same project.
- The second task uses files created in the first as input, but is not directly linked.
- Solution: put the path in the config of both projects. If the tasks can be run independently, those paths might not be the same. By reading from the config of one project you are forcing that project to be there, even though all you need is the files it created.
- The two tasks are loosely coupled (so shouldn't be one project) but expected to be run in sequence in the same location
- Solution: either have a controller project which calls one and then the other, passing the path as some sort of parameter (command line would be fine); or, store configuration information in a known common place (e.g. registry, user Local Settings folder, etc) and have both projects refer to that. (Essentially that is a controller but with no code, only data.)
By explicitly reading from an app.config file for another application, you are requiring that that application is present in order to run yours. If Project2 has that sort of requirement on Project1, it should be a part of the same project. My guess is that it doesn't, it only depends on the files Project1 creates, and therefore you should either point it at those files in its own config, or chain the two projects from a controller which sets the location for both of them.
|
|
|
|
|
BobJanova wrote: This seems like one of those things which is a bit hard because you shouldn't be
doing it.
I have to disagree. There have been a number of times where I wanted to read a config file from another app. All he has to do is load it as a standard xml file, and manually read the data. That's not hard at all.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
That's true, going in at the XML level is not hard, as long as MS keep the file format the same. Is the format of those config files a published standard that can be relied on?
|
|
|
|
|
Nothing that comes out of Redmond can be relied upon. If it's their standard, they can change it whenever their current CEO farts if they want to.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
It's just XML. Load the file and read the settings. It's as easy as that.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
That's part of why I don't use app.config. I roll my own and I can have applications sharing common config files.
|
|
|
|
|
Hello All Friends
I Want to Create A Custom DataGridView That Automatically Adds a New Row At The Begining Of dataGridView While Binding DataSource, This Row Will Use For Search And Filter DataGridView.
How Can I Add This Row While Binding A DataGridView.
|
|
|
|
|
You don't.
If I understand what you want this row for, I'd probably create a composite usercontrol with TWO DataGridViews. The 2nd one would be your data bound grid showing filtered data. The 1st one would be seperate, placed just above the 2nd grid, probably copying the column layout of the 2nd grid.
|
|
|
|
|
|
Hi Dave,
what would you do about column widths then? with a single DGV I like to use
AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells)
however with a little search DGV and a big result DGV (which one would like to be column-aligned at all times), the big one probably should set the widths for both, so can we get one DGV automatically (or at least easily) mimic another DGV's layout decisions?
|
|
|
|
|
Sure, either poll the columns widths after a filtered DGV updated (not my first choice) or see what the filtered DGV's ColumnWidthChanged event is going to do for you.
|
|
|
|
|
So no magic wand hidden somewhere deep inside DGV land; OK, thanks.
|
|
|
|
|
That seems to be the recurring theme in the questions today: "How can I automatically do this?"
Nope, no magic wand, unless you write it yourself.
|
|
|
|
|
So How Can I Add DGV's Predefined Properties And Members To Custom Control
Can You Give A Sample Code Please.
|
|
|
|
|
You'll have to create your own Properties, using the DGV's properties as their backing fields.
|
|
|
|
|
Hi,
The c# code is populating a workbook template with the latest data which is run by
the c# code...
in the c# code there is workbook.RefreshAll();
At this stage, I expect to see the latest data inside the spreadsheet BUT the template shows the old data which was in the template before.
To see the latest data, I have to go to the spreadsheet which was populated but I have to click on data, refresh data to see the latest figures.
How can I solve this please?
Thanks
|
|
|
|
|
A useful tip for solving a problem such as this is to look at the code generated by the MS Office macro recorder.
In your case go the spreadsheet, turn on the recorder, and perform the actions required to refresh the data.
Examine the macro's BASIC source code to find out how it was done. It usually fairly simple to write the C# version but if you have any problems post the macro code here.
Alan.
|
|
|
|
|
Hi,
Macro is not being used.
It is c# as mentioned before.
Thanks
|
|
|
|
|
Alan's right... Even if you're not using macros for your actual project, try recording a macro that does what you need. Excel will automatically generate the code in VBA, and you can use that as a guide to figure out how to do it in C#.
|
|
|
|
|
Yes I understand that you are not writing a macro but in many cases macro code and office interop code are very similar. This means that the macro code for the update operation will show you which methods and properties you should use in your C# code.
Alan.
|
|
|
|
|
hi guys,i would like to know how to create a captcha application using c# which must show the user a picture of a shape eg,circle etc,and this shape must be generated randomly each time the web page is loaded.
the application will require the user to identify the picture by typing in the name of the shape, than click the submit button.
|
|
|
|
|
This wouldn't be a good captcha ... it would only have a small number of possible results so it would be easy to spam past.
|
|
|
|
|
Some good samples here[^], note the second one is a CodeProject article.
|
|
|
|