|
Hi all,
this is not a clear C# problem, but the program is in C# and can't find a better place to ask.
So, the application have to maintain some documents, every user logging in must see and edit any of documents. My problem is: where to store these files? Until XP we used Program files\AppDir\Docs folder, but in Vista this not works. User's personal folders can't be used either. Please help with a good ideea/information
Thanks
|
|
|
|
|
Hi!
System.Environment.SpecialFolder.CommonApplicationData (or rather a subdirectory thereof) is the right folder for you.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
You could always use the IsolatedStorage classes.
|
|
|
|
|
We have just run into this same issue. We are now storing the docs under All Users\Application Data. This works for Win2000, XP, 2003 and Vista.
Under Vista, this is redirected through a junction to the folder c:\ProgramData.
If you want backward compatibility, use the All Users\Application Data path, otherwise, you could use the ProgramData path.
David
|
|
|
|
|
The following program reads from a text file containing numeric data stored in columns separated by one blank space. Write the code and compile it on your computer. Create a text file called myfile.txt containing a few columns (3?5 for example) of numeric data (real numbers) and test the program.
#include <stdio.h>
int main(void)
{
FILE *fp;
double val;
char ch;
fp = fopen("myfile.txt","r");
do{
fscanf( fp, "%lf", &val );
ch = getc(fp);
printf(" %lf",val);
if ( ch=='\n' || ch==EOF )
printf("\n");
} while ( ch != EOF );
fclose(fp);
return 0;
}
Modify the code so that the program additionally creates a new text file where it stores only the integer part (discard the factionary part) of the real numbers stored in myfile.txt. The new file should write data in the same format (3?5 with columns separated by space) as the original file. Include statements to check if the file was opened and closed successfully.
ad
|
|
|
|
|
Are you aware that:
- this is the C# (not the C/C++) formum
- we don't tend to make others homework for them
- you didn't even give a qustion
So this looks like:
- you are so lazy with your homework that you can't even be bothered to type a question
- and you don't even took you time to find the right forum
Conclusion:
I won't help either
|
|
|
|
|
Hi code-lovers
i want my programs as users can update their programs -i developed- from web, like "windows update"
how could i do?
|
|
|
|
|
Build > Publish %Your Project Name%
If you publish it to web, the program at client desktop will auto check the version number and update from the source url.
|
|
|
|
|
How to load treeview control from database using backgroundworker class.
|
|
|
|
|
What do you have already?
And please don't start a new thread for the same question every hour, that's considered rude.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Add a "DoWork" event to the backgroundWorker
fire backgroundWorker.RunSync(DataSet);
just paste the code in backgroundWorker_DoWork is fine
|
|
|
|
|
Hello experts,
I have a combo box with 26 items. Say A....Z.
I have another string that holds the item to match
I write following code..but it is not working why...?
strItemToMatch="C";
boolean isFound=false;
if (ComboBox1.Items.Contains(strItemToMatch.ToString()))
isFound=True;
else
isFound=False;
Regards
Pankaj Joshi
If you want to shape your dreams into reality, please wake-up...
|
|
|
|
|
Change
if (ComboBox1.Items.Contains(strItemToMatch.ToString()))
to
if (ComboBox1.Items.ToString().ToUpper().Contains(strItemToMatch.ToString().ToUpper()))
Hope it helps
Until you realize this message has nothing to say, its too late to stop reading
|
|
|
|
|
I write this
if (Convert.ToBoolean(cmbSubItem.Items.ToString().ToUpper().Trim().Contains(itemlist[0].ToString().ToUpper().Trim())))
But this is also not working...
Regards
Pankaj Joshi
If you want to shape your dreams into reality, please wake-up...
|
|
|
|
|
d@nish wrote: if (ComboBox1.Items.ToString().ToUpper().Contains(strItemToMatch.ToString().ToUpper()))
Sorry to say, but that's complete nonsense. ComboBox1.Items.ToString() will give you "System.Windows.Forms.ComboBox+ObjectCollection", so you send him down the wrong road.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Thanks for your reply I already explore this error....
And now code is
string strItemNameToFound = itemlist[0].ToString().Trim();
if (Convert.ToBoolean(cmbSubItem.Items.Contains(strItemNameToFound)))
But this is still not working any help...?
Regards
Pankaj Joshi
If you want to shape your dreams into reality, please wake-up...
|
|
|
|
|
My fault I accept.
Then the only way I can think of is to make sure that you are using right cases."Contains" is case sensitive.
Until you realize this message has nothing to say, its too late to stop reading
|
|
|
|
|
Hi!
ComboBox.ObjectCollection.Contains() does work properly, you're not using it correctly.
My guess is that you're not adding the items as string s, so the result you get from Contains() is correct.
Take a look at that code:
foreach (string s in new string { "A", "B", "C", "D", "E", "F" })
ComboBox1.Items.Add(s);
Debug.Assert(ComboBox1.Items.Contains("C"));
Debug.Assert(!ComboBox1.Items.Contains("Z"));
ComboBox1.Items.Clear();
foreach (char c in new char[] { 'A', 'B', 'C', 'D', 'E', 'F' })
ComboBox1.Items.Add(c);
Debug.Assert(ComboBox1.Items.Contains("C"));
Debug.Assert(!ComboBox1.Items.Contains("Z"));
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
I agreed with you.
But I'm not adding the items same as you. I'm filling item names from database and directly assign the datatable as datasource.
And this is also not working why.....?
Regards
Pankaj Joshi
If you want to shape your dreams into reality, please wake-up...
|
|
|
|
|
There you got it: You're adding objects to the ComboBox by databinding and then ask the ComboBox if its Items collection contains a string .
What the ComboBox is showing is the result of a call to .ToString() for each object in the Items list, but the elements in the List are not the actual strings!
So, as Luc suggested, using FindString() or FindStringExact() will probably be the easiest way.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Ya I got it.
Thank you very much for your help.
Regards
Pankaj Joshi
If you want to shape your dreams into reality, please wake-up...
|
|
|
|
|
Hi,
ComboBox.FindString and ComboBox.FindStringExact that may help you.
It is often useful to read the documentation on the classes you intend to use.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Hey Luc thank you very much for your reply.
It is working fine.
I also find the source of the problem.
Actually I directly assignthe data table as data source so what .NET do..?
It will add the data rows in the items collection. And that's why Contains not work because we are searching a string in complete data row.
I'll definately take care of it in the future.
Thank you once again.
One more question is their any problem to use FindString...?
Regards
Pankaj Joshi
If you want to shape your dreams into reality, please wake-up...
|
|
|
|
|
i am using the crystal reports using standard type.Can i show the records in the horizontal alignment.Like the Mail label type provides such functionality, can i do the same in standard version.
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
|
|
|
|
|
For that you have to use the mail label report. Because it will give you more flexibility to manage the different types of labels.
If you want to do it with standard type of report then you have to add the formulas that will calculate the record no and after certain number the record moves to the next column.
Regards
Pankaj Joshi
If you want to shape your dreams into reality, please wake-up...
modified on Wednesday, December 05, 2007 4:36:03 AM
|
|
|
|