|
tonyjsebastian1 wrote: Now i want this file to be opened whenever i click on this file by openfiledialog method
You write code for this
tonyjsebastian1 wrote: simply browsing the folder and double click this extension file .....
To do this, you write registry entries to associate your program with the file extension, and then when your app runs, you check the arguments passed in to see if there's a file path. If there is, you open it.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
What are you talking about--"I want it to open". Open where, File.Open or what? You mean the file should open for user then use System.Diagnostics.Process and use the start method or something like that. If you need answers, you have to put some time in asking and writing the right question.
|
|
|
|
|
There's little more annoying than people who delete their posts once they get an answer.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
well at least he got the answer...hopefully! I hope I wasn't rude to him.
|
|
|
|
|
hello all,
i have created a file of extension .ct, i want this to be opened when i double click on this file how can be this done in C#
Thanks
|
|
|
|
|
|
I am developing an application in .net 3.5 using this application setup i have to install crystal reports in silent mode on client machine.
Advanced Thanks
Ravikumar.
|
|
|
|
|
I assume you try to say that you need to setup Run-time packages for Crystal Reports only.
Business Objects provides an .msi file for run-time packages and you can google for "msiexec" and its options to run the .msi setup files in silent mode.
You may create a batch file with correct options of msiexec.
Hope this helps.
P.S: You cannot run setup for CR Run-time packages %100 silent mode because the .msi file requests EULA acceptance to start.
Always keep the Murphy Rules in mind!
|
|
|
|
|
hi..
it is right, but i am conceptually confuse that how can a super class keeps the reference of its sub class..please give me basic concept for that
eg:
class A
{
............
.............
}
class B:A
{
.............
}
class C:A
{
...........
}
now
A[] aa = {new B(),new C()}
its is right and ok
but can some one help me to clear my concepts
|
|
|
|
|
B is an A. C is an A. B and C can see protected and public members of A. There is no reference, B IS an A. C IS an A. You can cast it to an A if you want an interface that shows only what is visible to the base class.
If you want to iterate over this collection and know which A is a B and which A is a C, you can use the is keyword.
foreach(A a in aa)
{
if (a is B)
{
// it's a B
}
else
{
C c = a as C;
if (c != null)
{
/a is a C.
}
}
}
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
thanx Christian
its means to use the word "reference" is wrong in that senario
and my confusion is very much cleared now
|
|
|
|
|
Glad to help
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hello,
I am using two different instances of OpenFileDialog on two separate buttons to open file dialog.
In first dialog I am setting the path according to my requirement like this
openFileDialog1.Reset();
openFileDialog1.InitialDirectory = path;
But when i click other button to open file dialog, it opens at the location where first dialog was opened. Is it possible to store the different path location for each dialog?
regards
Gajesh
|
|
|
|
|
What are you asking? You are saying you are creating two different instances of OpenFileDialog--one for each button and when you change the initial directory for one, it is reflected in the second one? Reassure you are creating different instances because one instance should not have any affect on the other one. Post some code to clarify.
|
|
|
|
|
Thanks,
Please find the code here
private void button1_Click(object sender, EventArgs e)
{
openFileDialog1.ShowDialog();
openFileDialog1.Reset();
}
private void button2_Click(object sender, EventArgs e)
{
openFileDialog2.ShowDialog();
}
You will find that it always reset the path for different openFileDialog. It might be because of Reset() function.
Regards
Gajesh.
|
|
|
|
|
hello gajesh
use the code below to set different paths for openFileDialog
set for the openFileDialog the initial directories always...........
openFileDialog1.InitialDirectory= some path U Wish to open(store the different path location for each dialog);
thanks
Tony
|
|
|
|
|
Hi,
it all depends on FileDialog.RestoreDirectory:
- by default false, meaning your app's current directory will be set to your most recent selection (hence two dialogs will influence each other)
- when true, current directory is not affected (but if you want a dialog to open where
it got closed last time, then you have to program for that explicitly).
|
|
|
|
|
hey..........
plz respond
|
|
|
|
|
Thanks tony,
I found that the Reset() function is resetting path for all dialogs though they are different instances. I think i need to store the last path to the registry and read it back programmatically.
Regards
Gajesh
|
|
|
|
|
gajesh wrote: I found that the Reset() function is resetting path for all dialogs though they are different instances.
Of course not. It only resets the dialog that you call the method on. The other dialogs just use the current directory as initial directory. If you want a different initial directory you have to specify that for each instance.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Thanks for reply,
Have a look at the code
private void button1_Click(object sender, EventArgs e)
{
openFileDialog1.Reset();
openFileDialog1.ShowDialog();
openFileDialog1.InitialDirectory = openFileDialog1.FileName;
}
private void button2_Click(object sender, EventArgs e)
{
openFileDialog2.ShowDialog();
openFileDialog2.InitialDirectory = openFileDialog2.FileName;
}
You can never go to the path which you accessed last time for the same dialog.
|
|
|
|
|
Of course you can, you only have to assign the correct value to the InitialDirectory property. A file name is not a path.
openFileDialog1.InitialDirectory = Path.GetDirectoryName(openFileDialog1.FileName);
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hello All!
I am trying to write all items inside my listview control to a text file and I have the following code, I am
using System.IO;
File.AppendAllText("C:\\Users\\Jase\\Desktop\\File.txt", listView1.Items.ToString());
So, when I click on a button it will write each item to file but it doesn't work and I haven't been able to find any help on google or msdn. Does anybody have any pointers/links/samples they'd be willing to share? Thanks for reading.
Regards,
j.t.
j.t.
|
|
|
|
|
A quick look at the ListView class members states that Items is a property which returns ListViewItemCollection so no need to look further. Since you are executing the ToString() method on the ListViewItemCollection it is basically returning a string that represents the current object which is probaly something like System.Something.Something. There is nothing weird about that. If you have a class say:
class Employee
{
public string ToString()
{
// Here is the implementation for the ToString() method. Some classes return the object name, some
// return something meaningful but it all depends on the implementation. Some can event decide
// to return "In your dreams this would work!" which is unlikely but as long it is a string, it is
// valid.
}
}
If you want all the objects then do this:
// First save the ListViewItemCollection returned in a ListViewItemCollection reference
ListViewItemCollection allItems = listView1.Items;
Then iterate over all the items using foreach or some other loop. The other option you have is to extend the ListViewItemCollection class and override the ToString() method to return all the items instead of the base class implementation.
Or you can do this:
foreach(ListViewItem currentItem in listView1.Items)
{
// Here write each item which is currentItem to file
}
|
|
|
|
|
It's not weird at all. You assume that ToString will iterate over the collection, and find some sort of meaningful string value for each item. It plain isn't going to do that. I would imagine that you're getting ListViewItemCollection written to your text file. You need to write the code to work out a format for each item and to iterate over the items.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|