Click here to Skip to main content
15,890,579 members
Everything / Console

Console

console

Great Reads

by Marco-Hans Van Der Willik
This article continues with the development of the SOLID Poker project, and covers functionality to Compare and Validate Poker Hands.
by Robert S Sharp
I'm not sure that GC would matter very much in such a simple app.But, it's either a call to Dispose on your SmtpClient after you're done using it:smtp.Dispose();or use a using:using (SmtpClient smtp = new SmtpClient{ Host = "smtp.gmail.com", Port = 587, Credentials = new...
by Sunasara Imdadhusen
MS Test Result Viewer is a free open source library to convert MS Test result (.trx) file into HTML. It is also allowed you to perform MS Test on your test container project (.dll) file. This utility will work with simple command line arguments to generate test report in HTML format with excellent U
by Athari
CsConsoleFormat library for .NET - Formatting in Console using modern technologies

Latest Articles

by M@dHatter
Access private fields from Chained Extended classes
by Kenji Elzerman
A simple tutorial with some code of how to read text from an image with Azure Computer Vision
by SiretT
Console app to share internet connection with other network interface
by Shmuel Zang
Simple Java helper class to print colored text in console window.

All Articles

Sort by Updated

Console 

5 Nov 2016 by #realJSOP
This is not the place to go if you want someone to write code for you. I think I can safely say that nobody here works for free.This is a programmer's web site. I'm assuming that you think you're a programmer. If you can't come up with "any idea" on your own, maybe you should reevaluate your...
12 Feb 2018 by #realJSOP
Have you looked at this CodeProject article? Compiling C# Code at Runtime[^]
25 Jul 2019 by #realJSOP
LEARN.HOW.TO.USE.THE.DEBUGGER.
16 Mar 2014 by $*Developer - Vaibhav*$
Hi AllI have created one console application,having some ref dll.How to host executable (Console application exe) in windows service?Happy Holi.......... :)
5 Aug 2015 by _Dhull
In console application main how do we know that string[] args is optional? Because in c# we write optional parameter aspublic static int Maintain(int Nar=1){ return 1;}how string[] args is optional?
16 Nov 2013 by _Noctis_
A simple console application to visualize and understand recursion
27 Mar 2014 by Aaron Bo
HI friends:For these days, I am doing a practice about re-direct a console app into the other app, but, I don't resolve a problem that always produce dead lock locating ReadToEnd(), So I think to use asynchronous method, but this is not success for me, I hope you can help me to resolve the...
25 Sep 2012 by Aarti Meswania
One of the Favorite homework topics'*' pattern programs are like puzzles so, enjoy solving it.some references as...
1 Feb 2013 by aaverian
A very simple console progress bar.
4 Jan 2013 by Abdelrahman Elzedy
//scientific calculator in c++//written by Abd - elrahman Elmasry//e-mail: abdoasemelzedy@hotmail.com//there is no copy right for this code#include//main library#include// for mathimatics function#include//for exeption conditionsusing namespace...
4 Feb 2018 by abdul wadood
I have made a timer which runs backwards starting from 10.I just wanna create a little simple game.I wanna write the sentence 'I love programming' under 10 seconds if i am able to do it the message should shown 'You win , gratz' but when the clock runs out of time the message should be shown...
19 Oct 2014 by Abhijit Ghosh (Subho)
This is an alternative for "Creating a Issue in Jira using Rest API". This is an upgraded version as it contains a way of sending attachments with the issue. This version doesn't use MSXML as it is not recommended by Microsoft.
2 May 2013 by Abhik03
I have a console application(C#) which returns dynamic number of 3 different results after running a foreach loop. Now, I want to store those in a SQL table. Say the console returns values like,Name = John, Age= 23, Place= CaliforniaName= Roy, Age= 24, Place= CalcuttaName= Raul, Age=23,...
2 Jan 2014 by Abhinav S
You need to map the drive on the system (not via code).
17 Mar 2014 by Abhinav S
You cannot host a windows executable in a windows service.Convert the application to a service.
18 Mar 2014 by Abhinav S
Yes. However, you can be calling unmanaged code in a console application.
2 Apr 2014 by Abhinav S
Try How to Write a .NET Windows Service with Console Mode[^].
8 Dec 2015 by Abhinav S
If this question is for an article, ask it in the question answer forum at the end of the article.It is more likely that the author will get to know about your question and answer.
6 Feb 2018 by abhishekagrwl25
My requirement is to get keyspressed when user opens specific URL in chrome. For that I am firstly checking for URL opened in chrome after that I am setting hook using below code if(condition==1) { _hookID = SetHook(_proc); Application.Run(); } else if(condition==2) { Application.Idle...
7 Apr 2014 by Abinash_Sahoo
I believe you have to customize different service providers, these links may be helpful for youCustomize User Login When Using the WCF Authentication Service[^]Custom MembershipProvider and RoleProvider Implementations that use Web Services[^]
14 Jan 2022 by Abu Bakar 2022
I am a student of first semester and I am making a console based game in c++. There are two players in game, 'player-2' is CPU player and 'player-1' is controlable player. After every 20 seconds one of player becomes red and other becomes green....
25 Mar 2021 by Adi Mirza
I have a program that prints dates(Fridays) between two dates, code work fine, but I am having some trouble, In Visual Studion it's not printing dayLeft but when I checked the same code at .net fiddle there it print dayLeft, Second thing I want...
16 Dec 2015 by Aditakumar2311
I want to take input as "Integer" value only between 20 to 50. It should give error if any string value is taken or any value which is out side the range of 20 to 50.using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;using...
10 Mar 2015 by Aditya Chauhan
i have made a timer control in main(){ System.Timers.Timer aTimer = new System.Timers.Timer(); aTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent); aTimer.Start(); aTimer.Interval = 1000; aTimer.Enabled = true;}and call it private static void OnTimedEvent(object...
24 Mar 2015 by Aditya Chauhan
for (Int32 i = 0; i
24 Mar 2015 by Aditya Chauhan
case Keys.D1: if (Control.ModifierKeys == Keys.Shift) sw.Write("!");else sw.Write("1"); break;
27 Mar 2015 by Aditya Chauhan
I want to make my genuine.for bypass antivirus.what steps we use for bypass antivirus.i am a beginner,as consider it what steps we use ..for making perfect exe of my application.thanks My EXE bypass with Eset,MSE,ksk,Avirabut catched by Norton,avast,....
8 May 2015 by Aditya Chauhan
hello Experts, I want to share my problem with you,i developed a key logger in c# console based and windows form also its working fine,and also using stream writer to write a text file with keys.i am using it on windows 7.8 and when i am moving to windows 8.1 then it partially...
11 Dec 2015 by Aescleal
Does this line...cin >> message;...really do what you think it does?If you can work that one out then that's the root cause of the whole message not being encrypted.As for the other error perhaps have a dig through the code for ce() and cd() and work out what they're supposed to...
23 Mar 2013 by AfnanMof
Steps How to Develop Sharepoint Windows Forms
11 Dec 2014 by Afzaal Ahmad Zeeshan
In your code, you can easily instantiate the Progam class and create an object. Did you even give it a try? var program = new Program();Second while working with TCP you might consider looking into the System.Net namespace which would provide the basic but good documents about...
17 Dec 2014 by Afzaal Ahmad Zeeshan
You need to make a use of the Random class, to generate Random numbers. But, that would give you a Random integer, you can then use those numbers to call different alphabets at those indices. You can read my previous article to create Random strings for URLs, instead of using them in URLs...
31 May 2016 by Afzaal Ahmad Zeeshan
You just need to purchase a subscription from any hosting provider. There are multiple solution providers that provide competing packages for the companies and individuals. You can select from one of them. Since this is ASP.NET, I'd like to say you should go and visit here, ASP.NET Hosting | The...
9 Jun 2015 by agent_kruger
I have a project that is made on windows form and returns output (.exe) but i want it to return output file in (.dll). The reason why i want it in dll file is because this software has some additional features which every user shouldn't posses. Note:- i cannot change projects output type...
22 Dec 2016 by ahmed_sa
Hi i work in visual studio 2015 c# console applications . I try to make bubble sort to array unsorted but i cannot do thati search for internet about that i understand idea . it is make comparison between small and largest then swap items to make in order array but i cannot...
16 Oct 2021 by ahmed_sa
I Working on console application I ask why result is ClassB IT must be ClassC i executed app on console and it give me ClassB why final result ClassB i expect it will be ClassC What I have tried: using System; using System.Collections.Generic;...
17 Dec 2021 by ahmed_sa
I work on csharp i need to get value of period and Start date from variable productData so how to get data of start date and period from ProductData string variables using csharp string productData = Serial No :444909812 ItemType :Electricy User...
23 May 2012 by AhsanS
If you are logging like mentioned by Zoltan, then you can easily show the log in windows form by reading the contents of log file.
13 Feb 2013 by Alan N
It turns out there is some Windows API trickery for this situation.See the response by Willy Denoyette in http://groups.google.com/group/microsoft.public.dotnet.languages.csharp/tree/browse_frm/thread/c72efe6c358eca9e/588a7bf4cfb4832[^]using System;using...
2 Feb 2014 by albasith786
Hi, I'm having a asp.net code, that the web server will get the request from a external device(biometric) and response back to the device by "Response.Output.Write("OK");". Now I'm trying to do the same from console application. I'm getting the web request from device using HttpServer....
2 Feb 2014 by albasith786
The biometric device continously sending some request like http://localhost:8080/biocdta?SN=123....then have to get the query parameters and based on some condition i have to response back to the device as "OK". Then the device and db will connect. Now the problem is how to respond back to the...
11 Jul 2016 by Alberto Nuti
In a console application, there is often the need to ask (and validate) some data from users. For this reason, I have created a function that makes use of generics and delegates to speed up programming.
12 Jan 2017 by Alex Banu
to read input try like this:int op = 0;string in = string.Empty;do{ Console.WriteLine("enter choice"); in = Console.ReadLine();} while (!int.TryParse(in, out op));
8 Apr 2013 by Ali Zandian
Hi everyone, I need a method for divide two big numbers in string,( console app. and in c++ )for example :string s1 = "4234823759252523523502525234232"...( about 100 char numbers )"string s2 = "243423423423"...also like above"string Result = Divide(s1,s2);Thank you.
10 Mar 2013 by ali_heidari_
find main method wich is first method to start debug !write this line : System.Windows.Forms.Application.Run(new Form1()); // i consider Form1 is your windows form classthis line will make your windows form and will show it !do not forget to add System.Windows.Forms to your project...
27 Apr 2014 by Ami_Modi
I am writing mail sending script. In main thread the data is brought from database and mail is sent and as the mail sending starts few changes are made in database like sending_status become 'Sending' etc.I have used timer thread where every 5 mins a function is called and database is...
21 Apr 2014 by Ami_Modi
Hi guys..I want to encrypt mail id. The encrypted mail id should not contain special characters.I have used this: string EncryptedEmailId; string EncryptionKey = "MAKV2SPBNI99212"; byte[] EmailIdEncrypt =...
23 Apr 2014 by Ami_Modi
I got my ans from here:http://www.nullskull.com/faq/834/convert-string-to-hex-and-hex-to-string-in-net.aspx[^]a) Convert String to Hex public static string ConvertStringToHex(String input, System.Text.Encoding encoding) { Byte[] stringBytes =...
5 Jan 2015 by Amir Mohammad Nasrollahi
hi all, recently i started coding in C language (my specialty is c# and php and i am new to c commands).Im looking for some functions to clear screen from line 'x' up to end of screen and i just find system( "cls" ); that do my propose but from first line up to end (whole of screen).so any...
22 Feb 2016 by an0ther1
Console applications end when the program completes, try this;a) Open Visual Studio & create a new Console applicationb) Enter the following in the Main methodstatic void Main(string[] args){ Console.WriteLine("Hullo World");}c) Compile the applicationd) Browse to the...
18 Apr 2015 by Anbu_Mannan
foreach (DataRow dr in Ds.Tables[0].Rows){ WPService4Sales.WPServiceLive.Service sj = new WPService4Sales.WPServiceLive.Service(); doc = sj.INSERT_SALES_WITH_CUSTOMER(username, passwrd, dr["Region"].ToString(), dr["StoreName"].ToString(), dr["StoreCode"].ToString(),...
4 Jan 2013 by Andreas Gieriet
This is mainly a parsing task, not really suited for a C++ beginner.An expert in parsing would solve this within a few hours - a complete novice might take months to get it somehow done.I would choose a different topic, depending on your personal interests or hobby.Think also of where C++...
17 Apr 2015 by Andy Lanng
There are two parts to a process run in a cmd terminal: the process and the terminal itself.When you run a command in the terminal, that command will output to a buffer. if that buffer gets full then the process waits for the buffer to be read so it can continue.The terminal reads from...
17 Apr 2015 by Andy Lanng
I want 5 start ^_^This is a whole class. It doesn't use any assemblies outside of the standard libraries. it can be made even nicer with RX for example, which allows you to turn events into IEnumberables in a much better way that I have done here.If your looking for that, search for...
27 May 2015 by Andy Lanng
I got it. Thanks for posting the code. I know the error:ints are problematic. you would think that (1/2) would equal 0.5? well c# says it's 1.operations on ints returns an int.//Every time z1+z2 is odd, you will lose precision.public double Find_C1(int Z1, int Z2){ ...
12 Jan 2017 by Andy Lanng
Quote:BTW sorry for using gotos please dont flame meHa - two days and you already know everyone's biggest bug-bear ;)The toggle here: l1finished = !l1finished; is unnecessary. Just use l1finished = true;In the 'LevelMenu:' segment, you write out the "Level Menu" + 27 clear lines but...
27 Mar 2018 by Andy Lanng
Updated to 2017: using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Threading; namespace ProcessWithOutput { public class ProcessWrapper : Process, IDisposable { public enum PipeType { StdOut, StdErr } public class...
29 Apr 2015 by Angelieri
On Page directive also use EnableSessionState="False"It works for me.
7 May 2013 by Anilkumar2vvv
U have to define arguments what ever u pass to the console application and just the run the console application using command prompt by passing values.
2 Feb 2016 by Anisuzzaman Sumon
use below code you should add using System.Net; to run this code if there any problem then feel free to ask again with specific problem details. and don't forget to show your code.happy coding :)static void Main(string[] args){ using (WebClient wc = new WebClient()) { ...
21 Aug 2016 by Anisuzzaman Sumon
here is your complete solutionstring s = "Hello Anis PID=27HMJ-GH7P9-X2TTB-WPHQC-RG79R is a pattern"; s = Regex.Replace(s, @"(P)(I)(D)(=)[A-Z0-9]{5}(-)[A-Z0-9]{5}(-)[A-Z0-9]{5}(-)[A-Z0-9]{5}(-)[A-Z0-9]{5}","[Your replacement String]", RegexOptions.IgnoreCase);Out put will...
31 Oct 2018 by Arun Babu Madhavan
Extension method to throttle multiple Tasks in C#
1 Feb 2017 by Arun Maiya
After seeing your comments I understand that you are talking about clearing the console before printing the output. Pass clear screen command to your console.case 2:system("cls");c = subt(a, b);cout
10 Jan 2012 by Ashish_oswal06
pls find how i insert image in excel sheet cell, I use c# code which create excel file without need excel in server .
17 Jun 2014 by AshishvermaMCA
Hi,It will help you-http://stackoverflow.com/questions/9655376/write-contents-in-a-txt-file-in-a-tabular-order-using-c-sharpFollow this link.
31 Jan 2017 by Ashwin. Shetty
Look at c# - Ensuring only one application instance - Stack Overflow[^] & Restricting a C# Application to a Single Instance[^]
11 Oct 2013 by ASP.NET Community
Getting started with MongoDBMongoDB is a famous representative of NoSQL databases. It is a document-oriented database, which means that data will
3 Mar 2018 by Athari
CsConsoleFormat library for .NET - Formatting in Console using modern technologies
11 Sep 2014 by aurobindadash
I want to develop a report where the report header section values change on different pages and the report body should bind according to the header values. And the header section should display in each page of the report even though there is a subreport page breaks happens.Now I am passing 2...
4 Aug 2020 by avnish kumar maddheshiya
Is there any equivalent for OnHandleCreated & WndProc functions for a Window Service similar to the one in C# for a form? I need to implement WatchBP SDK(USB Library) for window Service that works with WebSocket to get data from the device to...
2 Mar 2017 by Awesh Vishwakarma
The easiest way to use Entity Framework with SQLite databases in C# Winform and Console Applications
2 Dec 2013 by Aydin Homay
Hiyou should set Console.OutputEncoding and Console.InputEncoding follow of these exmple:Console.OutputEncoding = System.Text.Encoding.GetEncoding("Cyrillic"); Console.InputEncoding = System.Text.Encoding.GetEncoding("Cyrillic");you can get more information from these...
17 Jul 2013 by bado2015
What is the output of this program?classA a = new classA() { data = 5 };classA b = a;b.data = 10;Console.WriteLine(a.data);
15 Dec 2011 by Balakrishnan Dhinakaran
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace ConsoleApplication1{ class Program { static Random newletter = new Random(); static void Main(string[] args) { string[] alphabet; ...
4 Feb 2013 by BC @ CV
You should be able to render any file as a byte array. I do this all the time when I render RDLCs as PDF or Excel files in the browser. I render them to a byte array then write this to the response stream. In your case you would just add the byte array into an Attachment object.VBDim att...
22 Apr 2013 by bEGI23
Hi i am trying to load an extern Executable from Windows Application but without success.Because i need Windows App i want to also run the executable from it and not from a separate Console App. The File which i try to load is also a Windows App(.NET Exe.)It just works fine LOADING it from...
8 Mar 2016 by Ben J. Boyle
From the pdflabs examples at https://www.pdflabs.com/docs/pdftk-cli-examples/pdftk in1.pdf in2.pdf cat output out1.pdf
21 May 2014 by Bernhard Hiller
Add an additional unique constraint to your table, such that fields which you check for duplicates are guaranteed to be unique by SQL Server already.You can set constraints e.g. with SQL Server Management Studio (click on the table - then Constraints - then "New Constraint").An index could...
4 Jul 2012 by bhagirathimfs
Unreachable code detectedBecause of the last line .The last line of the function never execute due to the return line written above the Console.WriteLine(number);Remove the last line or write the line above the return statement.and also consider answer 1 Please write something(call...
30 Mar 2014 by Bhagyashree Chaudhari - Member 10473634
HiI have one console application, in that if i got any error so simply used Console.Write("error message ") which shows message on console screen.But now , i want to do , log report whenever any error generated by application , i have to get mail on my id , with error message.like in web...
7 Apr 2014 by Bhagyashree Chaudhari - Member 10473634
i used but it was not working.but thankx for response.
14 Jul 2014 by Bhagyashree Chaudhari - Member 10473634
Good Morning ,I have create one console application , its runs by schedule.Now i have one facility of email , in that i am sending one image which uses "http://maps.googleapis.com/maps/api/staticmap?center=........" this path and its X any Y centers are coming through my console application...
15 Dec 2013 by bharat peggem
My c# console application reads data from a excelsheet which is located at C:\Data and my c# console app can be installed in any directory in the system and my requirement is to move the excelsheet to the same location as my c# console application,so that means i won't be providing path...
17 Jan 2012 by BillWoodruff
Suppose you have some sample code that uses formatted strings written to the Console: like:Console.WriteLine("{0} (quantity {1}) was replaced by {2}, (quantity {3}).", item.Description, item.Quantity, replacement.Description, replacement.Quantity);And, you'd like to quickly convert all...
22 Dec 2012 by BillWoodruff
I can see, by your response to my comment on your question, that you have already figured out the essential aspect of accessing files in your own DropBox, on your own computer.Yes, DropBox files in the Public folder, on your machine, use a hard-coded six-digit ID number; however, shared...
1 Mar 2014 by BillWoodruff
When you use the {#n} substitution place-holder in a string, there must be a number of arguments, after the string, which correspond to the zero-based index number inside the {}.When you write: Console.WriteLine("The Greatest of 3 numbers is {1}",_secondNumber);The compiler looks for a...
11 Mar 2015 by BillWoodruff
Your code as shown never stops the Timer. Also, to use a System.Timers.Timer and raise an event on a UI thread, you must set the System.Timers.Timer 'SynchronizeObject property.Here's an example that is based on working code in a WinForms Application:0. create a reference to a new...
31 Oct 2015 by BillWoodruff
To add to what Maciej has shown you here:There are several ways to create a "blank" File can be created in C#:1.File.Create(pathName); // will leave the created File openSince leaving the File open is often not desired:using (File.Create(pathName))using (File.Create(pathName))...
20 Dec 2012 by Blake Miller
You still need to include "windows.h" for the windows application even if it is a 'console' application because you want to use calls like LoadLibrary and such, which are perfectly valid to call.You obviously need to remove the message boxes and other calls that bring up windows, if you...
25 Jan 2022 by BlobifyYT
I made a class named Wizard with some basic stuff like name and spell slots and experience and I have this Wizard wizard01 = new Wizard(); And I want the user to choose between wizard01 and wizard02 by turning them into numbers. So if the user...
29 May 2014 by BobJanova
This is a silly application, but presumably you know that. That algorithm's not useful for anything.Console and windowed desktop applications have somewhat different use paradigms, so it isn't so much a case of 'converting' as working out how your core algorithm should be presented in the...
16 Feb 2015 by BulletVictim
Good Day AllI would just like to find out if it is possible to track the IP address of a remote pc accessing(coping,creating,deleting,renaming) a file on a server.Just a quick scenario:I have a server with files on it, limited amount of people have access to the shared files. I would...
6 Apr 2023 by Cameron Handoe
HelloAs part of a personal project, I need to make a console based Scientific calculator.It needs to be able to add, subtract, multiply and divide a large amount of numbers per command (eg: 2+2+2+2+2+2*9/7*sin 45- 88.277) and be able to manipulate numbers correctly using BIDMAS.It...
12 Feb 2015 by carlitosd19
I everyone, I want to develop an app on C# but have to look like old console programs like 15 or 20 years ago, with menus, and dialog menus
5 May 2021 by Carlos Conceição
Current features of NSimpleOlap library
3 Jan 2013 by Caroline White
I'm using the Console class in Holtsoft's Ready To Program Java for this. I'm not allowed to use javax.swing or make this an applet. I don't know how to make the program, but need to make it:a) Run only in the console window orb) Make the Frame window hidden, but still...
1 Nov 2014 by ch12
How to Create reporting tool that reads any data files in different formats and creates an output file in CSV format using Console application .
31 Mar 2014 by Chamadness
You should probably use an HttpWebRequest and a cookie container: var client = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(sUrl);client.CookieContainer = new System.Net.CookieContainer();
2 Jan 2015 by chandanadhikari
hi,check that when you are executing this code, are you passing a command line argument ? because in this code, inside the main function, the argv array is being used and it might be missing so its complaining.In Visual Studio, you can add arguments in the Project Properties. Right click...
7 Feb 2014 by CHill60
Hopefully these will get you started ... the last one is not on CodeProjectUsing WIN32 Message Queue in C++ / WIN32 Multithreaded Applications[^]Simple Multithreaded Application in pure C, Win32 and MFC[^]The Practical Guide to Multithreading - Part 1[^]Multithreading...