|
There is an article here at CP which shows how to do file association. Search for it.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
Not really......!!
when we double click a file say of any extension, it got opened in its application(which is associated with it).
i just want that. I am storing filename only (file remain in a folder), and wants when user click on the filename. It got opened.
Or say just making a list of file present in specific folder(wheteher its .txt, .rtf, .doc, .pdf etc).
Now just wants whenever user click on particular filename, it got opened(not go to that folder and fron there open that file).
|
|
|
|
|
That is called "associating a file extension with your app"
really.
you got the right answer twice.
And if you are going to contradict the truth one more time, you're a moron.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
I don't think he wants to associate a file extension with his program, I think he wants to be able to open an external file in the appropriate program.
Hum Dum, if I'm correct you just need System.Diagnostics.Process.Start(). So if you have a file at C:\testfile.txt and you want to open it in Notepad you could just do something like this:
System.Diagnostics.Process p = new Process();
p.StartInfo = new System.Diagnostics.ProcessStartInfo("C:\testfile.txt");
p.Start();
|
|
|
|
|
Thanks for reply.
hollismarek wrote: I think he wants to be able to open an external file in the appropriate program.
Absolutly correct.
But one question related to this process,
Is it going to slow or create any overhead on my application ?
as user will click many times to open a file.
for that i have to run each time this.
|
|
|
|
|
If you dispose of the process object after calling Start I think you should be ok.
|
|
|
|
|
Luc Pattyn wrote: you're a moron
I suppose this forum is for help, not for shouting
I am just clearing my doubts,
If its related with file association, then i will do it.
But for just opening a file doing all this association ??
I am just looking for simple solution.
But with reply like that...
"I am understanding how mature you are...!!"
|
|
|
|
|
I am working on this application(asp.net 1.1,sql server 2000) that has a huge database , in the frontend there is a provision
to generate a csv file by running a stored procedure which can fetch 50000 records(approx), to acieve this I've used the
following:-
1) running forloop iterating through the dataset and creating a comma separated string, then creating the csv file, but this
process slows down the server immensely when data fetched is huge.
2) DTS packages is failing, because when I am creating a new package and click the defeine column button, the SQL Enterprise
manager just closes itself after a few seconds.
3) BCP command, sometimes works sometimes does not. The code used for running bcp in C# is :-
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo.FileName = "bcp";
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardError = true;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.Arguments = @"""exec ETH11.dbo.usp_DownloadInvoiceforDalkia "" queryout ""D:\NewLookLogs\Invoice.csv"" -c -t ,
-T -S";
proc.StartInfo.Arguments = proc.StartInfo.Arguments.Replace("usp_DownloadInvoiceforDalkia ","usp_DownloadInvoiceforDalkia
"+"'"+xSupplierID+"',"+"'"+xBuyerID+"',"+"'"+xFromDate+"',"+"'"+xToDate+"',"+"'"+xType+"',"+""+xCurrentOnly+","+""+xDateType+
","+""+xStatus+","+""+xAllStatus+","+""+xContentType+","+"'invoice.csv',"+"'"+Session.SessionID+"'");
proc.Start();
proc.WaitForExit();
|
|
|
|
|
please don't cross post.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
A few months ago some of you helped this hardware engineer with a c background understand that list elements are passed by reference. I solved my immediate problem but have run into another wall.
I have two global lists defined in my form:
List <CUserMem> MemoryBank = new List<CUserMem>(100);
List <CUserMem> CombinedMemories = new List<CUserMem>(100);
After a while, the first list becomes has out of date info and I must "garbage collect" by copying the still-needed elements of the first list to the second list. I simply do :
CombinedMemories[Index].whateverelement = MemoryBank[AnotherIndex].whateverelement;
It works the first time through but of course the next time I update MemoryBank, CombinedMemories is also updated. I tried to avoid this by:
local (temporary) variable = MemoryBank[AnotherIndex].whateverelement;
CombinedMemories[Index].whateverelement = local (temporary) variable;
That doesn't work. After the local variable is destroyed, the two list elements still have the same reference.
So what is the correct way to work with 2 global lists like this?? Can I create a copy of the first list that is not "linked" (have the same reference)???
Thanks -
Chuck
Chuck
|
|
|
|
|
1. Please tell us more about CUserMem and whateverelement so we can help you better.
2. Is it the intention to have each item in one of the lists, but never in both of them?
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
CombinedMemories[Index].whateverelement = (cast as appropriate) MemoryBank[AnotherIndex].whateverelement.MemberwiseClone();
This will give you two separate objects with the same contents instead of multiple references to the same object.
|
|
|
|
|
Gerry:
Thanks fot taking the time to reply.
I had seen a couple of references to the fact that cloning a List just copies the references, so you end up with the same problem I started with. See: http://social.msdn.microsoft.com/Forums/en-US/netfxbcl/thread/de75a3c3-2920-48ae-bf85-0399e5ee7a10 and also http://weblogs.asp.net/jeff/archive/2005/11/21/431125.aspx .
But wanting to give it a try anyhow, I took your advice and used MemberwiseClone with your syntax:
CombinedMemories[NumberOfCombinedMemories].bUsed = (Boolean) MemoryBank[i].bUsed.MemberwiseClone();
but get the following error:
Error 3 Cannot access protected member 'object.MemberwiseClone()' via a qualifier of type 'uint'; the qualifier must be of type 'WindowsFormsApplication1.Form1' (or derived from it)
This I do not understand.
Chuck
|
|
|
|
|
Chuck,
I had to make a few assumptions from your original post, assuming you wanted to "clone" a "member" in the list, and not the list itself.
Anyway, cloning a "list" would clone "references" for a "shallow" clone; but would create new objects for a "deep" clone. Same with cloning a single object; shallow cloning would create references for "fields" in the oject that referenced other objects, but would create new objects referenced for by those fields for a deep clone.
Anyway, here is an example of how I understood your problem in the first place; cloning an "element" (ie. object) from one list to another where that element / object does not reference other objects:
(Note that strings, while being reference types, are "deep" cloned in this case ... )
<pre>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1 {
class Program {
static List<Widget> List1 = new List<Widget>();
static List<Widget> List2 = new List<Widget>();
static void Main( string[] args ) {
List1.Add( new Widget() {
Description = "I am a Widget",
OtherData = "12345"
} );
List2.Add( List1[ 0 ] );
Display( "@1" );
List1[ 0 ].Description = "I was changed";
List2[ 0 ].OtherData = "abcde";
Display( "@2" );
List2[ 0 ] = List1[ 0 ].MemberwiseClone();
List1[ 0 ].Description = "I was cloned";
List2[ 0 ].Description = "I am the clone";
Display( "@3" );
}
public static void Display( string location ) {
Console.WriteLine( location + " List1 = {0}; List2 = {1}",
List1[ 0 ].ToString(), List2[ 0 ].ToString() );
}
}
class Widget {
public string Description;
public string OtherData;
public new Widget MemberwiseClone() {
return ( Widget ) base.MemberwiseClone();
}
public override string ToString() {
return Description + "(" + OtherData + ")";
}
}
}
</pre>
modified on Wednesday, November 11, 2009 5:46 PM
|
|
|
|
|
Gerry:
This was a wonderful piece of help with a concrete example to giuide me. I've got the code fixed and I learned something in the process. Can;t beat that combination.
Chuck
|
|
|
|
|
Thanks for the feedback, Chuck. I appreciate it.
|
|
|
|
|
I'm using a stored procedure (proc) for the SqlDataSource1 of my local report (rdlc). I've changed my proc to include an additional field. When I try to edit my local report to add the new field, it does not show up in the dataset or fields under the expression buider. How do I get the dataset to recognize my new field.
|
|
|
|
|
Yes.. this is really a problem with rdlc console.
I think you need to clear the existing dataset from the report to continue.
Right click on rdlc report -> Open With Xml Editor
After you open find <Dataset> and remove its content. Now open the report, add any field to the report, your dataset will be added again with all the fields. (You can also update the report xml with your new field)
Note: Before you do, backup your existing dataset to avoid corrupt of the report.
|
|
|
|
|
I edited the xml, which solved the problem. Your the best. Thank You very much.
|
|
|
|
|
Thank you so much...
Cheers.
|
|
|
|
|
Hi there sorry to be a pain again, but is there any simple way of tracking the progress of a object deserialisation??
|
|
|
|
|
What do you mean ? Serialisation takes place in one step, AFAIK.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
yes i know serialisation takes place in one step what i need to know is how much of a file it has deserialised as i need to display the percentage to the user while it is deserialising the file (on a background thread)
|
|
|
|
|
Are you deserializing a huge file ??? Actually we deserialise objects which are smaller in size and it takes just a moment to deserilize. I dont know if there is any option as you are not reading the file in bytes. if you read it so, it would also take such a negligible time so that no progress is displayed over screen..
Why do you require such thing. Rather if you are deserializing a collection of objects, you can deserialize each of them, one by one and do generate one event to send percentagecomplete value.
|
|
|
|
|
private void btn_Next_Click(object sender, EventArgs e)
{
Plugin p = new Plugin();
nextImage = nextImage++;
string _Ext = p.Ext;
ass = Assembly.GetExecutingAssembly();
imageStream = ass.GetManifestResourceStream("NameSpace.Images." + nextImage + _Ext);
pictureBox1.Image = new Bitmap(imageStream);
this.btn_Previous.Enabled = true;
if (nextImage == p.End + 1)
{
this.btn_Next.Enabled = false;
}
}
I'm wondering how to write this to make it work, and make it clean, any suggestions?
|
|
|
|