Posts
 
Reputation
Joined
Last Seen
Ranked #2K
Strength to Increase Rep
+0
Strength to Decrease Rep
-0
78% Quality Score
Upvotes Received
4
Posts with Upvotes
4
Upvoting Members
3
Downvotes Received
1
Posts with Downvotes
1
Downvoting Members
1
4 Commented Posts
0 Endorsements
Ranked #14.9K
Ranked #4K
~17.1K People Reached
Favorite Forums

14 Posted Topics

Member Avatar for Ghost

[QUOTE=Ghost;103285]Hi, i'm new 2 C#, so my question may seem stupid... but, what is the code to exit an application. I know in java it is: [CODE]System.exit(0);[/CODE] Thanx in advanced, C++[/QUOTE] [CODE] System.Environment.Exit(0); [/CODE]

Member Avatar for vasanthmc2
1
10K
Member Avatar for RossR

Try setting the IsMdiContainer property from the properties box. (Not in your event method) You can set IsMdiContainer to true within the Form1.Designer.cs file or after InitializeComponent() in the forms constructor.

Member Avatar for williamrojas78
0
141
Member Avatar for stevanity
Member Avatar for danuz

[QUOTE=danuz;1417708]Yes its not a good way of code, but I need to explain to assistent it anyway xD[/QUOTE] Array.Sort() sorts the elements in an entire one-dimensional Array using the IComparable interface implemented by each element of the Array. Straight from MSDN.

Member Avatar for ddanbe
0
111
Member Avatar for Drakarus
Member Avatar for james6754

[QUOTE=james6754;1416009]Hi all...could anyone please tell me how when working with arrays you could use a forach loop to output the number of a certain item... for instance...if i wanted to find out the number of 5's in an array...could i use a foreach loop to find that out? Thanks[/QUOTE] [CODE]public …

Member Avatar for Venjense
0
124
Member Avatar for m_wylie85

You can identify your teachers home drive with: [CODE]Environment.GetEnvironmentVariable("HomeDrive").[/CODE] For your hard coded location alternative try: [CODE]Environment.GetFolderPath(Environment.SpecialFolders.MyDocuments) + "\\data.txt"[/CODE]

Member Avatar for iconoclazt
0
164
Member Avatar for m_wylie85

[CODE]public string GrepLineFromFile(string path, string pattern) { if (File.Exists(path)) { foreach (string line in File.ReadAllLines(path)) { if (line.Contains(pattern)) { return (line); } } } else { Console.WriteLine("..file does not exist"); } return (string.Empty); } [/CODE]

Member Avatar for iconoclazt
0
122
Member Avatar for m_wylie85

A really simple solution. [CODE] private void AppendToFile(string path, string contents) { try { StreamWriter sw = new StreamWriter(new FileStream(path, FileMode.Append, FileAccess.Write)); sw.Write(contents); sw.Close(); } catch (Exception e) { Console.WriteLine(e.Message); } } [/CODE]

Member Avatar for iconoclazt
0
177
Member Avatar for pilipino93

[CODE] public void RenameFileOrDirectory(string sourceFileName, string destFileName) { try { if (!sourceFileName.Equals(destFileName)) { FileAttributes attr = File.GetAttributes(sourceFileName); if ((attr & FileAttributes.Directory).Equals(FileAttributes.Directory)) { Directory.Move(sourceFileName, destFileName); } else if ((attr & FileAttributes.ReadOnly).Equals(FileAttributes.ReadOnly)) { Console.WriteLine("..that is read-only"); } else { File.Copy(sourceFileName, destFileName); File.Delete(sourceFileName); } } else { Console.WriteLine("..epic failure"); } } catch (Exception …

Member Avatar for iconoclazt
0
149
Member Avatar for Drakarus

[CODE] public void TextFileToList(string path) { List<string> exampleList = new List<string>(); if (File.Exists(path)) { foreach (string line in File.ReadAllLines(path)) { exampleList.Add(line); } } } [/CODE]

Member Avatar for iconoclazt
0
150
Member Avatar for vedro-compota

You could always create a directory specifically for your application which would house many important files pertinent to the aforementioned application. [CODE] public string storageDirectory; public void InstallStorageDirectory() { // I've found that LocalApplicationData and ApplicationData seem to be interchangeable. this.storageDirectory = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\yourStorageDir" if (!IO.Directory.Exists(this.storageDirectory)) { try { …

Member Avatar for iconoclazt
0
108
Member Avatar for vedro-compota

[QUOTE=vedro-compota;1419434]good evening)) (At us now evening)) Please answer the question - there's a code fragment - [CODE] public string MAP(string FilePath) { FileStream fs; // объявляем байтовый поток try { fs = new FileStream(FilePath, FileMode.Open); } catch (FileNotFoundException exp) { [B][U]return[/U][/B] exp.Message; } catch { [U][B]return[/B][/U] "not possible to open …

Member Avatar for iconoclazt
0
120
Member Avatar for Peter1

[QUOTE=Peter1;1420070]I'm new to c#. [B]How do I add five numbers to each other and indentify the highest and lowest value together with the average value of this five numbers?[/B] Please give me something to begin with (or a whole example of code to study). Have a nice day. Thank you.[/QUOTE] …

Member Avatar for iconoclazt
0
202

The End.