|
Thank you very much...You've help me a lot...
Thank you...
|
|
|
|
|
Glad it turned out alright.
I will use Google before asking dumb questions
|
|
|
|
|
Hi, I've tried to open a file that is placed in a folder of web application in a editor that is made using windows application. Let us suppose i have a folder in http://localhost/MySite/MyFolder/doc.doc. Now what i need to do i want to open this file in that editor. I also want to display the file names of MyFolder. Please help me out and let me know is there any way to do so. It will be very nice of you.
Arslan Ilyas
Red Signal
|
|
|
|
|
arslanjatt wrote: a file that is placed in a folder of web application
How about a HttpWebRequest?
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson
|
|
|
|
|
I've tried this one but by using this i can read the contents of page. But i want to open a word file. It only read the html of that page. I've tried this one. Is there anything else? Thank you any ways
|
|
|
|
|
|
Hi all,
I am using StreamWriter to create a .txt file with the help of a counter. Which means, if a file is created, the title would be message1.txt. if a second file is created, the title would be message2.txt. The counter will increase everytime the button is clicked. eg. ( "message" + intCounter + ".txt")
However, when the program is closed and run again, the new content of the textbox overwrites message1.txt instead of creating a new file named "message3.txt".
I've heard of the command File.Exists so that the program checks for the latest number of the counter so that it can continue with the next number.
How is this done?
|
|
|
|
|
troubled one wrote: I've heard of the command File.Exists so that the program checks for the latest number of the counter so that it can continue with the next number.
How is this done?
File.Exists() checks to see if the file with the specified file exists on the harddrive.
troubled one wrote: I am using StreamWriter to create a .txt file with the help of a counter. Which means, if a file is created, the title would be message1.txt. if a second file is created, the title would be message2.txt. The counter will increase everytime the button is clicked. eg. ( "message" + intCounter + ".txt")
However, when the program is closed and run again, the new content of the textbox overwrites message1.txt instead of creating a new file named "message3.txt".
You'd better save the counter in the application's settings, this way you will be sure that at the next restart of the application the counter will have the last value you saved.
Hope it helps.
I will use Google before asking dumb questions
|
|
|
|
|
But how do you save the counter in the application's settings?
I've put "intCounter=1" at the form load.
|
|
|
|
|
In the project, there is the Properties folder. In that folder there is the Settings.settings file. Double click it and in there you can add the name of the setting, the type, scope, and value. Set the name as Counter (for ex), type int, scope User. Take a look in the designer file and make sure that there is a GET/SET property for the name you have filled in. There you can also see the namespace which you can use to get the data. Let's say that your project is called MyProj. To get or set the data from/to the counter you write:
int x = MyProj.Properties.Settings.Default.Counter;
MyProj.Properties.Settings.Default.Counter = x;
MyProj.Properties.Settings.Default.Save();
MyProj.Properties.Settings.Default.Upgrade();
The last 2 methods must be called when you change the value of the Counter from the settings.
Hope it helps.
I will use Google before asking dumb questions
|
|
|
|
|
You can find the no of files on a particular folder like
cmbFileNames.items.clear();
DirectoryInfo di = new DirectoryInfo("C:\My Folder");
FileInfo[] rgFiles = di.GetFiles("*.txt");
foreach (FileInfo fi1 in rgFiles)
{
string fileName = fi1.Name;
cmbFileNames.Items.Add(fileName);
}
di = null;
Here I add the all available text files into the combo box hope this helps!!!
After that your will loop through the combo and split the file names like
message3.txt I.e. message length is 7 characters and after that count and then [.txt] So this will work for any case like
message3.txt
message233.txt
message154821.txt
Convert the
-- modified at 2:07 Friday 23rd November, 2007
Regards
Pankaj Joshi
If you want to shape your dreams into reality, please wake-up...
|
|
|
|
|
troubled one wrote: the latest number of the counter
You ought to persist this value to a permanent data source across application sessions. Did you consider the registry?
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson
|
|
|
|
|
Have a question.. I'm currently working on a project that's all about
updating excel documents with a current one through a program. since we're
dealing with spreadsheets that have a huge number of cells (some more than
100 sheets) I have to do everything through the program to make it faster..
I have to name the columns alphabetically just like excel does...
e.g. 1 = A, 702 = ZZ, 27 = AZ, so on and so forth..
now I got up to ZZ with one go.. forgive me if I show my solution that isn't that good...
and if it's not optimized then forgive me as well since I'm still new at it.
string[] alphabet = new string[] { "A", "B", "C", "D", ............ , "Z" };
string[] alphabet2 = new string[] { "Z", "A", "B", "C", "D", ...... , "Y" };
//you'll understand why later...//
int input = 0;
int otherletter = 0;
if (input < 27)
{
output = alphabet[input - 1] //since the index starts at 0//
console.writeline(output);
}
else if (input > 26) //AA - ZZ or 27-702
{
otherletter = input / 26 //just get the whole number no
fraction..left letter//
input = input % 26; //modulus for the letter on the right//
output += alphabet2[input];
output += alphabet[otherletter - 1];
console.writeline(output);
}
so for 702 (which is ZZ)
input = 702
input = 702 % 26 (which is zero...that is why Z is at index zero in alphabet2)
otherletter = 702 / 26 = 26.something (which uses the alphabet string array)
that isn't very nice to look at but it gets the job done.. the problem now
is what to do beyod 702? I already have a tentative solution.. which includes
using the number 702... it's almost the same as this solution just add
another "else if" but the problem is when I get to 18954 which is "ZZZ" and
so on and so forth?
does it really mean I have to make another else if everytime a letter is
added as the number goes higher? or is there a better logic other than my
approach? I'm sure there is... anybody out there? I don't care if the answer
isn't in C#... I'll just have to get the idea then maybe I could use it..
thanks.. sorry for the poor code work
|
|
|
|
|
|
ummm... thank you for the link.. but I don't get it? I was lost with the link that you gave me. I need something that has to do with Excel column name generation... or maybe I just didn't get it.. could you please share a little light on the link you gave me?
|
|
|
|
|
Can you not treat this as a Base26 number, with "digits" "A" to "Z"?
|
|
|
|
|
now that has to be the best reply I've ever had! hehe thanks! base26 definitely was the answer... for people having the same problem.. I've stumbled on a very interesting piece of base26 example.. though it's not exactly like excel.. if you play with it.. you'd still get what you want.
here's the link..
http://en.wikipedia.org/wiki/Hexavigesimal[^]
|
|
|
|
|
Can i get a source code of an RFID Project in c# ?
|
|
|
|
|
|
Yes, may not be over here in this forum
Once you have mastered the ability to turn yourself invisible at will, and to deflect bullets with your hair, you will be ready to come back here to the lounge and post programming questions.Only at this point will you be able to dodge the fireballs that are going to come your way. - Pete O'Hanlon
|
|
|
|
|
There's no standard project with RFID. The RFID readers from different producers may have a different instruction set...so if you create a project based on some reader, on another one it may not work...since it won't recognize the instructions you send to it.
I will use Google before asking dumb questions
|
|
|
|
|
Please do not post multiple times or cross post across forums. I would suggest you give a reading on Forum Posting Guidelines at http://www.codeproject.com/scrapbook/forumguidelines.asp[^]
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson
|
|
|
|
|
Source code of a RFID project in c#
|
|
|
|
|
Right Click > View Source
Once you have mastered the ability to turn yourself invisible at will, and to deflect bullets with your hair, you will be ready to come back here to the lounge and post programming questions.Only at this point will you be able to dodge the fireballs that are going to come your way. - Pete O'Hanlon
|
|
|
|
|
.CS wrote: Right Click > View Source
A sweet answer.
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson
|
|
|
|