|
how can i create the text file in the streamwriter in ascii code,
file.createtext has just one argument which is path name and dont include the encoding argument so how could u create the file in any ascii code?
|
|
|
|
|
Posting the same question again will not get you a better answer
only two letters away from being an asset
|
|
|
|
|
|
I know this topic doesnt really fit this section.. but my program was written in C# and I didnt know where to put it
So the problem is I deleted accidently my main c# file from vs project and that way it was also deleted from the real file system. I used ontrack recovery and it doesnt seem to be in the deleted files.. nor is it in the trash. I made a test and after I deleted another file from the project it landed in the trash with a different random like name xs =]
Anyone one know how to recover this file ? or does the vs has anykind of after-deleter-change-name algorithm? Im really despered.. i spent alot of time on it =/
|
|
|
|
|
I'm afraid if it's deleted, it's deleted.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
yeah after hours of searching.. I started writing the code again.. well its a good lesson to me, to make backups of all precious data I have.. Sorry for the spam I just went mad
|
|
|
|
|
I have a user control that work as a parent and contains a collection that keep track of objects or child controls ..
I need a way to fire an event that is handeled within the user control or do some action "refresh for example" when a new object or Control is added to this Collection "ParentControl.Childs.Add(NewChild)"
Thanks in advance
|
|
|
|
|
Hello,
Maybe you could call a recursive methode in your usercontrols constructor, which goes threw the Controls Collection and links to all "ControlAdded" events.
<code>//constructor code
this.MyRecursiveMethode(this.Controls)
private void MyRecursiveMethode(ControlsCollection cc)
{
if(cc!=null)
{
foreach(Control c in cc)
{
//link to the event
c.ControlAdded += new System.Windows.Forms.ControlEventHandler(this.Control_Added);
//Call the method again and again and ... , as long as neccessary
MyRecursiveMethode(c.Controls);
}
}
}
private void Control_Added(object sender, System.Windows.Forms.ControlEventArgs e)
{
//link the event of the new added Control
e.Control.ControlAdded += new System.Windows.Forms.ControlEventHandler(this.Control_Added);
//here is your code
}</code>
Hope that helps you.
All the best,
Martin
|
|
|
|
|
thnks so much martin for your wonderful effort and help ..
i found the way and solution to my problem using the help of your thought specially the use of ControlAdded event .. i wired the event to the panel that hosts that ChildControls ..
my 1st idea was to try to hock this event to the System.Collection.Add method itself (i have a collection that keep track of the controls rather than the controls property of the panel)i thought i could respond when a new item or control is added to this collection .
.. but i really couldn't undersatnd the use of recursive method .. any way thanks again for your help Martin
|
|
|
|
|
Hello everyone,
I am using C# on a Pocket PC 2003 project based on .Net Compact Framework of Visual Studio 2005. I want to re-draw some controls of a Form (Window) at a regular interval (for example, change the title of some Label or something similar). The issues I met with are,
1. My application has several Forms/Windows. How to check whether the specific Form/Window (which I want to re-draw) is active? If the Form/Window is not active, I think I should not re-draw the Form/Window. Am I correct? Or, whether or not the Form/Window is active, I should always re-draw the Form/Window?
2. Any code samples specific for C# of .Net Compact Framework?
thanks in advance,
George
|
|
|
|
|
how can i convert utf-8 encoding text file into ascii encoding??
streamwrite write the text file in utf-8 encodinf the streamreader read it as utf-8 but if i want to deal with the file as ascii what to do?
|
|
|
|
|
The StreamReader and StreamWriter only uses UTF-8 as default if you don't specify an encoding when you create them.
---
b { font-weight: normal; }
|
|
|
|
|
Hi
I've recently started with VS 2005 using C# (Windows Forms) and have encountered a problem.
I added a reference from Solution Explorer to the System.Drawing assembly as I thought I would need this assembly. Once I'd added it I realised that it was some GDI stuff that I didn't actually need, so removed before doing anything further, by right clicking on System.drawing and selecting remove.
It successfully removed the assembly reference, however unfortunately when the reference was added it seemed to have added a whole lot of code to my file, main.designer.cs (I've only got one form), such as
this.cmdRefresh.location = new System.Drawing.Point(100,308).
This caused compilation errors because the reference is no longer there, and it didn't seem to do any clean up of the code it apparently added.
I did try removing the references manually (despite the warnings not to), but then the positioning of the controls on the form is lost.
I'd be grateful for any help on this and apologies if it's anything obvious.
Dave G
|
|
|
|
|
Windows Forms applications always depend on System.Drawing. The designer always generates "System.Drawing.Point" code, so I'm pretty sure you already had a System.Drawing reference (it's there by default for new Windows Forms projects).
|
|
|
|
|
is system32 a defultt directory to install windows service using installutil service.exe if so can i chage this if yes how.
|
|
|
|
|
To install :installutil /i <full file path to service.exe>
To Uninstall :installutil /u <full file path to service.exe>
Hope this is what you need..
|
|
|
|
|
i want to fill an array with files and folders which are defined by user..
path of files and folders given by user. and every folder and files must kept in an array..
for example:
user gives us C:
and program must fill array like that
arr[0]="c:\Documents and Settings";
arr[1]="c:\Documents and Settings\user_name\";
arr[2]="c:\Documents and Settings\user_name\dekstop";
arr[3]="c:\Documents and Settings\user_name\dekstop\xxx.txt";
...
...
it goes like that..
i found something in MSDN but it is not actually what i want..
please help..
|
|
|
|
|
All you have to do is create the DirectoryInfo[^] instance for the user provided directory and then recursively traverse the file/directory hierarchy, adding the files and directories to a list. The second example in the link I posted shows you how to do that.
|
|
|
|
|
How do I truncate a float such that if i have 1.20001, i would want to have 1.2 only for display. How could I achieve this? Thank you very much!
|
|
|
|
|
If you just want the truncated value as a string, you can use the ToString method on the float instance, like
float f = 1.2001f;
string truncatedFloat = f.ToString("0.0");
If you want that value as a float, you could multiply it by 10x, where x is the number of digits of precision required, cast it to an int and divide by 10x again i.e 1.20001 * 10 = 12.0001 = 12 / 10 = 1.2
|
|
|
|
|
works perfectly well. Thanks!
|
|
|
|
|
S. Senthil Kumar wrote: If you want that value as a float, you could multiply it by 10x, where x is the number of digits of precision required, cast it to an int and divide by 10x again i.e 1.20001 * 10 = 12.0001 = 12 / 10 = 1.2
Note that this is not guaranteed to produce the exact value that you expect. A float only has a precision of seven digits, so the result may just as well be something like 1.19999 or 1.20001.
And why not use Math.Round(f, 1)?
---
b { font-weight: normal; }
|
|
|
|
|
Guffa wrote: Note that this is not guaranteed to produce the exact value that you expect.
Agreed, I missed the fact that the floating point representation could screw up things. But if he already uses tolerance values when checking for equality among floats, this shouldn't matter, right?
|
|
|
|
|
i need to have a windows service setup file which will accept
parameter..
the set up user interface should have a text field which will take a parameter and then this parameter should be used in the windows service. any idea i need only help.
|
|
|
|
|
Two group of cards (one with 10 cards , another with 5 cards), what I want is to discard one card out of 10 cards from one group and it become 9 cards. Then I choose one of the cards from another group with 5 cards by clicking the card. After I choose it , I want to be added that card in the group with 10 cards again! How can it be work?
|
|
|
|