Click here to Skip to main content
15,890,670 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 

16 Apr 2024 by mbue
This code is obsolete since win2000 because every process has its own wave mapper. The code seems to try if the wave mapper (win95) is already in use - not a specific audio file. To try if a specific file is in use you should open the file...
13 Mar 2024 by Uzbek Tv yangiliklari
I don't have any strong enough knowledge to build this kind of app, console-based. As far as I have info about how to build this kind of console-based app, it requires Windows Audio Internal API, if i am not mistaken, it's WASAPI. But since I...
29 May 2023 by Flo_89
Hello :)For testing purposes I created a C# ConsoleLine application. Now I want to do a GUI and so I choose Project --> Add component and added a "Windows Forms" element. But although there is no Console.WriteLine or something left he always opens the Console and he does not show my Windows...
11 May 2023 by punk_legend
I've written an html scraper which runs fine apart from on pages that have a popup message box (example here Untitled hosted at ImgBB — ImgBB[^]) , these seems to remain open, which eventually causes the machine to run out of memory and crash. ...
14 Apr 2023 by Gcobani Mkontwana
Hi Team I am developing a react-native, but i am experience some length error problem with my firebase version. How do i configure this version in react-native? What I have tried: // Import the functions you need from the SDKs you need import...
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...
26 Feb 2023 by uuu99933
Hi all! Are there people who write or wrote on Win9x? I have a question about the function ReadConsoleInput in console. For some reason, on Win9x systems, random stutters occur when this function returns. The difference can be up to 10 times...
26 Feb 2023 by merano99
According to Microsoft documentation, the system call is not suitable for Win9x. readconsoleinput Minimum supported client is Windows 2000 Prof Since Win9x does not support preemptive multitasking, you would need a non-blocking alterative to...
16 Jan 2023 by M@dHatter
Access private fields from Chained Extended classes
1 Jan 2023 by Member 15881599
private void status_Click(object sender, EventArgs e) { string filepath = textBox1.Text; try { using (Stream stream = new FileStream(textBox1.Text, FileMode.Open)) ...
1 Jan 2023 by Member 11250091
How to check file is open or not from specific folder.
21 Dec 2022 by Reza jafery
I found a good example: using System; using System.Diagnostics; using System.Threading; using System.Threading.Tasks; namespace ConsoleApp { class Program { const long LOOP_COUNT = 900000; static long Calculate() ...
21 Dec 2022 by Reza jafery
Hi guys, In my article, I want to compare the speed of sequential processing to parallel processing in various conditions, so in one example, I want to convert the following sequential command to parallel, but after converting it to parallel, it...
16 Dec 2022 by OriginalGriff
Multithreading isn't a magic bullet: it can't just speed up your code and give you massive speed improvements, and it certainly won't give you repeatable results every single time. The reason why is simple: you have N cores on your processor: 1,...
28 Nov 2022 by mayrasof
You have to enable the 2 factor authentication on your email account, then create an app password and use this password in your program. Check this link "Using app passwords with apps that don't support two-step verification".
21 Nov 2022 by OriginalGriff
Think about what you have to do, and take them one at a time. I'd suggest that you write each shape as a separate function, so it's easy to test and modify the code without affecting anything else. When you get one working, move on to the next,...
13 Nov 2022 by Kenji Elzerman
A simple tutorial with some code of how to read text from an image with Azure Computer Vision
12 Nov 2022 by Xzahn
Hi folks, I've been banging my head on this issue for a week now. The more time I spend on it the more stuck I feel. The basics are as follows: Edit: Where I have mentioned Main.JS, MapContainer.JS, and StationsAPI, there are all links to code in Pastebin! I'm using React, Webpack 4,...
12 Nov 2022 by Member 15828992
How did you solved the problem? Than you
13 Oct 2022 by Member 15796535
Deprecation of Basic authentication in Exchange Online | Microsoft Learn[^]
9 Sep 2022 by Magnus Sydoff
Hello all, Background: I'm writing an application that in some cases will have an Blazor UI. Due to this I want to deliver the Blazor UI part as a plug-in. I already have a few plug-ins that are non UI and that works fine. Since I'm a newbie when...
9 Sep 2022 by Graeme_Grant
You are wanting to have a Blazor Hybrid app. Here is Microsoft's explanation and examples: ASP.NET Core Blazor Hybrid | Microsoft Docs[^]
6 Sep 2022 by Dave Kreskowiak
You cannot just call any method on any object you want in a parallel fashion. None of the StringBuilder methods can be called from multiple threads at the same time and have your output make any sense. The List class is also one of those classes...
6 Sep 2022 by Reza jafery
Hi guys, Since I'm concerned about speed and efficiency, I began reading Gastón C. Hillar's Professional Parallel Programming with C# book and want to rewrite my project from the ground up using the parallel programming approach. In the following...
6 Sep 2022 by Richard MacCutchan
See the notes at Parallel Loops | Microsoft Docs[^].
2 Sep 2022 by Mony2020
main.java import java.io.File; import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class Main { private static String[] name; ...
2 Sep 2022 by Richard MacCutchan
In your main method you have the following lines: private static String[] name; public static boolean readFile(String filename) { File file = new File("studentdata.txt"); try { Scanner scan = new...
2 Sep 2022 by OriginalGriff
That's because your teacher helpfully added markers where you need to provide code: students.add(student);`enter code here` The `enter code here` bit is not executable Java code but an instruction to you ... You should expect to get...
3 Aug 2022 by Richard MacCutchan
Use a DataAdapter and it will fill it automatically: string cmdString = string.Format("Select * from [{0}]", sheetName); OleDbCommand cmd = new OleDbCommand(cmdString); cmd.Connection = connection; OleDbDataAdapter adapter = new...
3 Aug 2022 by Himansh jain
getting this Error Severity CS0029 Cannot implicitly convert type 'System.Data.OleDb.OleDbDataReader' to 'System.Data.DataRow' What I have tried: System.Data.DataTable datatable = new System.Data.DataTable(); var...
24 Jul 2022 by Petr Barabáš
I'm trying to read an email from my mailbox using the MailKit library. Unfortunately the program throws this MailKit.Security.AuthenticationException: 'LOGIN failed.' The credentials match (I tried to log in through the browser) I'm trying to...
16 May 2022 by sr18acv
am looking forward to creating a program to read m3u tv streams. the idea is that I will provide an m3u link and I will use the terminal to navigate between channels and watch them, so far am trying to use the VLC library on Python but nowhere I...
9 Mar 2022 by SiretT
Console app to share internet connection with other network interface
24 Feb 2022 by Shmuel Zang
Simple Java helper class to print colored text in console window.
21 Feb 2022 by Illya Reznykov
Creating Regional Web ACL with CloudFormation
21 Feb 2022 by Illya Reznykov
How to update EmailMessage properties that don't have public setters
18 Feb 2022 by Richard MacCutchan
The first thing you need is a Python library that can handle these files. The first link thatGoogle finds is GitHub - globocom/m3u8: Python m3u8 Parser for HTTP Live Streaming (HLS) Transmissions[^].
7 Feb 2022 by J. Frank Reeves
Power of JavaScript template literal
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...
24 Jan 2022 by Luc Pattyn
If you put all your instances of the Wizard class in an array, you can pick one by indexing that array; that would result in translating an integer number (zero-based) into one of a range of pre-instantiated wizards, like so: Wizard[]...
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....
14 Jan 2022 by Luc Pattyn
Assuming you know how to run towards some point, how about running in the opposite direction? In other words, assuming you have available for each point the distance to some point, rather than going downhill, go uphill.
13 Jan 2022 by KarstenK
Sounds like an threading problem. As informtic student you should use some MVC architecture or MVVM architecture to avoid such edge cases. The result shoulde be: 1. the model calculates ALL position 2. the drawing code draws ALL elements (at once)
30 Dec 2021 by Magnus Sydoff
I'm writing a console application using Net6. It runs on Raspberry, Ubuntu and Windows. The user can quit the application by pressing Q, Ctrl-C or close the window. I'm detecting the Q press in my static void Main method bool requestShutdown =...
30 Dec 2021 by Magnus Sydoff
Thanks to Luc who helped me in looking into this problem more thoroughly. Before Lucs comment on using AppDomain.ProcessExit I actually tried this previously. My mistake was to just put a log4net debug statement in the event handler. Since the...
28 Dec 2021 by Luc Pattyn
One event[^] should cover all of it... :)
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...
17 Dec 2021 by OriginalGriff
Try a Regular expression: (?:Start Date :)(?\d\d\d\d/\d+/\d+)(?:.+?End Date :)(?\d\d\d\d/\d+/\d+) Will split out the date info from your examples, and you can then use DateTime.TryParse to convert them to DateTime objects.
5 Dec 2021 by Member 13998042
I am trying to create a console application . i am using restsharp package to call a restapi . i am getting error in "acceptallcert". and the error is "an object reference is required for the non-statis field,method or property...
5 Dec 2021 by OriginalGriff
This is one of the most common problems we get asked, and it's also the one we are least equipped to answer, but you are most equipped to answer yourself. Let me just explain what the error means: You have tried to use a variable, property, or a...
21 Oct 2021 by Luc Pattyn
You can't "run" a Form without a message loop/pump. To get one, you need to call Application.Run() Without a pump the Form will be dead, no events will occur, the PB will not show anything. But then, with a pump, your Console App basically got...
21 Oct 2021 by gggustafson
I am attempting to implement an image viewer in a Console Application. The viewer will be ported to a Raspberry Pi and executed using Mono replacing the debian-installed feh image viewer. I am replacing feh because that program uses a fixed...
21 Oct 2021 by User 9916080
The problem is that you forgot to add the picture box control to the form. I modified the code to work correctly. It's been tested and it works. The lines I added have the comment "Added" to it. if (File.Exists(image_path)) ...
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;...
16 Oct 2021 by OriginalGriff
It's because a is a ClassA variable: it only "knows" about ClassA and overrides in derived classes. In ClassB, the Print method is overridden, so when you try to call Print on a it searches for the highest level override it can find - but since...
16 Oct 2021 by Wendelius
Few things, you have defined the variable as classA. You create the object from ClassC but still the signatures are from ClassA because of the definition. So when you call the Print method it is executed from classB because it overrides the the...
5 Aug 2021 by User-8621695
I have created one Python exe which is reading data from Config.Json. Now I want to call this exe from C# console application, but I am getting an error stating Traceback (most recent call last): File "file.py", line 552, in ...
2 Aug 2021 by Kadir Beskardes
namespace ShopTime { class Product { public int ProductID { get; set; } public string ProductCode { get; set; } public string ProductName { get; set; } public double Price { get; set; } public ...
2 Aug 2021 by Tony Hill
It is because you created your Cell_Phone class with a constructor requiring three parameters but only pass one when the object is instantiated in Main class you only pass a brands enum. As the constructor seems to populate the fields depending...
15 Jul 2021 by guptaritu
i'm working with rest api and i have a query count the number of times success runs, failure runs and if code fails then send a email. What I have tried: i have a url and i want how many times url status is success = true and success = false
15 Jul 2021 by SeeSharp2
When you make the call to the API check the return status. Then record the results in a database so that you can then count how many times it was successful, etc.
22 May 2021 by l o o l
If you need input interaction in your bat file, use: ���Set /p "variable_name=some string in screen: " @echo off setlocal cd /d "C:\Program Files (x86)\Program Name\Bin\" :loop cls & echo\ set "program=" & set "next=" & ( set /p...
22 May 2021 by Member 13813026
Here is the batch file that launches the program and prompts the user for input (hard coded within executable) C: CD C:\Directory\PROGRAM.exe\Subdirectory\ PROGRAM The cmd console opens and pauses for user input of the input file name. What I have tried: I have tried C: CD...
5 May 2021 by Carlos Conceição
Current features of NSimpleOlap library
5 May 2021 by ekonapikin1990
Hi all, I have a test written in java script that produces a large amount of console outputs. passed and failed scenarios I just want the FAILED "SCENARIO# FAILED" TO DISPLAY AND "SCENARIO# PASSED" NOT TO Because I want to save this failed...
5 May 2021 by ekonapikin1990
Figured out my own question Just needed to change console.log()==> disableLogger(); logger.disableLogger(); console.log(exampleof_passedscenario); Changed console log(); logger.disableLogger(exampleof_passedscenario);
31 Mar 2021 by Sergey Alexandrovich Kryukov
This is just a funny Visual Studio Code extension, but… what can happen if somebody will try to use it seriously?
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...
25 Mar 2021 by Slow Eddie
I have never understood writing to a console. I have created a data table but need to view it to make sure I am saving the correct data in the correct order. I found a vb.net example on Microsoft's on-line help but it requires writing to the...
25 Mar 2021 by OriginalGriff
Unless you are writing a Console app (instead of a WPF or WinForms app) you don't normally have a console - instead Console.Write commands write to the Output pane of the debugger (as do Debug.Write commands). It is possible to add a Console to...
25 Mar 2021 by Richard MacCutchan
Yes, because your print statement is incorrect. it should include the item reference for the variable: Console.WriteLine("Days Left are: {0} ", dayLeft);
22 Jan 2021 by vganchev
Hello, I have a problem with my javascript. When I run it from the developer console the code is working. When I use my code to create the extension - I receive error. Thanks in advance! What I have tried: var fullOffer =...
22 Jan 2021 by Christian Graus
Your object is null. So clearly the context causes it to not exist
1 Dec 2020 by Member 13440673
Greetings all Console app in c#. I need to build a big image from a dataset of small images. and get avg rgb values of tile images and then the avg rgb values of the big image that was generated from the tile images in the dataset. Firstly...
1 Dec 2020 by Patrice T
Quote: I am trying to figure out fastest method for building a mosaic of sorts from the dataset Don't! Don't try to find fastest algorithm from scratch, never. As you are new to this problem, you need to understand how it work. How to solve the...
22 Nov 2020 by oronsultan
Hey guys, I tried to summarize this as much as possible, I am sorry in advance for the length of the text. I need your help in solving a problem we've been trying to deal with for the past few days. So the story is this: we wrote a console application that extracts a large amount of data from a...
21 Nov 2020 by Dave Kreskowiak
That's not going to happen on Windows. You cannot get that kind of precision on a shared system that is not a real-time O/S. Events like that are guaranteed to happen NO SOONER THAN SCHEDULED. That does not mean exactly as scheduled.
21 Nov 2020 by sara98
Hi, I want click on button at exact time, for example (11:10: 10: 122), without even a few milliseconds of error (or a maximum of 10 milliseconds) my button i wrote this code but has...
18 Nov 2020 by Illya Reznykov
How to mock & test methods with out parameters
15 Nov 2020 by Member 14993732
Write a console app that declares two classes Employee (base) and (10) Receptionist (derived). • Include within Employee class private members: emp_name, emp_lastname, emp_id,emp_physicaladdress and overridable public member Allowance() which...
15 Nov 2020 by OriginalGriff
Read the question again. You appear to have created the Employee class, but there is no sign of a Receptionist class which is specifically required. And it needs to be derived from Employee, since a Receptionist is also an Employee. When you...
10 Nov 2020 by Yisrael Lax
.NET Library for automatically validating and casting console input parameters
22 Oct 2020 by NagaRaju Pesarlanka
Hi,I have a problem with reading RSS data.my code isstring url = "http://wwww.test.com"; XmlTextReader reader = new XmlTextReader(url); var xmlDocument = new XmlDocument(); xmlDocument.Load(reader);I got this...
17 Oct 2020 by husna bieber
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Lab_Week6 { class Program { static void Main(string[] args) { int[] arr = new...
17 Oct 2020 by Patrice T
Quote: i mean it doesn't gave result. Your code do not behave the way you expect, or you don't understand why ! There is an almost universal solution: Run your code on debugger step by step, inspect variables. The debugger is here to show you...
17 Oct 2020 by OriginalGriff
You need to set up a loop around your existing code: string reply = ""; do { ...your code here ... Console.Write("Do you want to exit now? (Y/N)"); reply = Console.ReadLine().Trim().ToUpper(); } while...
4 Aug 2020 by honey the codewitch
In order to give your service a UI you must add it to an account with a Allow Interaction With Desktop option set. c# - Allow Windows service to interact with desktop - Stack Overflow[^] Rather than duplicate the instructions, i provided this...
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...
3 Aug 2020 by Garth J Lancaster
While you could in theory write a C# service that uses P/Invoke to do this (manage a hidden window), I doubt the effort required would weigh up against the one-use value of that approach. I think you are far better off sticking to a Winforms...
3 Aug 2020 by OriginalGriff
No. Services do not - and cannot - have a UI at all, cannot interact with the user, and do not respond to messages other than System messages. They do not have a Window Handle because ... they don't have a Window. They can't be derived...
30 Jul 2020 by Garth J Lancaster
As suggested by ZurdoDev although the OP has posted my comment .... That's a bit odd .. try adding si.WorkingDirectory = @"D:\appFolder"; making the code si.WindowStyle = ProcessWindowStyle.Normal; si.WorkingDirectory = @"D:\appFolder";...
30 Jul 2020 by User-8621695
As @Garth suggested above to add working directory,I added that and it worked for me. so code is: string appArgs = @"D:\appFolder\config.json"; string appPath = @"D:\appFolder\filePathExe.exe"; Process proc = new Process(); ProcessStartInfo si =...
30 Jul 2020 by DiponRoy
Making schedule jobs exe using Quartz scheduler
17 Jul 2020 by Ultran Messiski
Just use a app virtualizer like Enigma Virtual Box (free) or BoxedAppPacker (not Free) in top of that if you have no issue with loading dlls and functions one by one manually you can do manual mapping.
2 Jul 2020 by Daniele Fontani
Sometimes, for learning, we need to find excuses to start a new project
30 Jun 2020 by Member 12885549
I am creating an app which has to wait for TCP messages and when there's one - create text file with that message data. For that I created .NET core console application. However I stumbled upon problem that after writing message/getting exception...
4 May 2020 by honey the codewitch
Start out with the basics for command line argument processing and exception handling for your console based utilities
4 May 2020 by Member 11955245
Need some guidance here - Requirement- I have 1000 SQL servers and I have a scheduled task running on all of those which updates a table with just an integer, let's call it X (its a sum of some numbers). Now the ask is to create some sort of...
4 May 2020 by RickZeeland
Maybe you can use ApexSQL Propagate instead of writing a C# application: Multi-database SQL script execution | ApexSQL[^] Or take a look at this CodeProject article which uses SignalR: SQL Server Notifications on Record Change with SignalR and...
4 May 2020 by Dave Kreskowiak
Well, if you can't use 3rd party solutions, you're going to have to write a service that runs on all of the SQL Servers. This service would get the data it needs from the server it's running on and send it to a central SQL database. Your website,...