Category about C-sharp

[2020-11-22 17:58:28] Get Remote HTML Code as String [C-Sharp / Networking]
Here is an example function to get the full html output code of an URL provided to the function into a string. You can get the data by using a string variable which gets the output: string variable = gethtmlcontent("https://thisisapage"); public string gethtmlcontent(String URL) { HttpWebRequest request; HttpWebResponse response; ...
[2020-09-24 07:38:02] Add Colored Text To RichTextBox [C-Sharp / Hints]
You can add this function to display colored text in a richtextbox! [Just Append With that Function] private void AddTextToRTB(RichTextBox rtb, string txt, Color col) { int pos = rtb.TextLength; rtb.AppendText(txt); rtb.Select(pos, txt.Length); rtb.SelectionColor = col; rtb.Select(); rtb.DeselectAll(); } ...
[2020-11-22 17:44:49] Allow Application Run Only Once [C-Sharp / Hints]
Here is an example to allow software to run only once on a machine. If the user tries to start the application again, there will ne a notification box and the program will exit. [file] program.cs in visual studio using System; using System.Threading; using System.Windows.Forms; namespace myapplicationnamespace { static class Program { /// <s...
[2020-08-25 19:25:09] Get the current Directory [C-Sharp / Hints]
Here the code to get the current Directory! string path = Directory.GetCurrentDirectory(); See more detailed Info here: https://docs.microsoft.com/de-de/dotnet/api/system.io.directory.getcurrentdirectory?view=netcore-3.1 ...
[2020-09-24 07:36:29] Load an XML exe.config File (Custom Path) [C-Sharp / Hints]
Here an example to load an custom application xml config file. // Load Configuration CurrentConfPath = "C:\\PATH\\TO\\EXE.CONFIG"; ExeConfigurationFileMap configMap = new ExeConfigurationFileMap(); configMap.ExeConfigFilename = CurrentConfPath; Configuration config = ConfigurationManager.OpenMappedExeConfiguration(configMap, Confi...
[2020-09-24 07:34:46] Prepare Scripts for SSL Connections [C-Sharp / Hints]
If SSL Connections fail with Security Protocol Error, this code in Main Function could do the trick! ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 | SecurityProtocolType.Ssl3; ...
Switch: 176 | Arrive: 253
This Website is using Session Cookies for Site Functionality and AWStats.
Staff may be MiA!