console-application

Displaying data of data table

我与影子孤独终老i 提交于 2019-12-09 16:22:15
问题 I want to display values or write them to a text file that it is written as such from a data set ColumnID columnName ColumnFamilyName ValueOne ValueTwo ValueThree ValueThree ValueFour ValueFive ValueSix ValueSeven ValueEight I have done this which does not do the trick foreach (DataRow row in myTopTenData.Rows) { Console.WriteLine(); foreach (DataColumn col in myTopTenData.Columns) { Console.Write(row[0].ToString() + " "); } } How can I do this? 回答1: I still can't post a comment but here is a

Why is AsyncContext needed when using async/await with a console application?

 ̄綄美尐妖づ 提交于 2019-12-09 14:50:26
问题 I'm calling an async method within my console application. I don't want the app to quit shortly after it starts, i.e. before the awaitable tasks complete. It seems like I can do this: internal static void Main(string[] args) { try { Task.WaitAll(DoThisAsync()); } catch (Exception ex) { Console.Error.WriteLine(ex); throw; } } internal static async Task DoThisAsync() { //... } But according to Stephen Cleary's article it seems like I can't do that and should instead create some kind of context

Get file size from SFTP using SharpSSH

会有一股神秘感。 提交于 2019-12-09 14:03:54
问题 I'm uploading a zip file from local directory to SFTP using SharpSSH. Everything works fine. However, I would like to get the file size of the current file I just uploaded. The reason I'm doing this is that the zip file is big (from 45 GB to 80 GB) and I want to make sure that during the upload it didn't fail or stuck. Want to make sure the entire zip is uploaded. I can get the file size of the local zip file like this: DirectoryInfo di = new DirectoryInfo(yesterdaysArchiveFolder); FileInfo[]

Win32 C++ console clearing screen without blinking

旧城冷巷雨未停 提交于 2019-12-09 13:30:34
问题 I've seen some console games where the screen refreshes/clears itself without the annoying blinking. I've tried numerous solutions, here's what I got as of now: while(true) { if(screenChanged) //if something needs to be drawn on new position { COORD coordScreen = { 0, 0 }; DWORD cCharsWritten; CONSOLE_SCREEN_BUFFER_INFO csbi; DWORD dwConSize; HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); GetConsoleScreenBufferInfo(hConsole, &csbi); dwConSize = csbi.dwSize.X * csbi.dwSize.Y;

How do you combine multiple TUI forms to write more complex applications?

落爺英雄遲暮 提交于 2019-12-09 12:56:02
问题 I would like to write a program with a T ext-based U ser I nterface (TUI) that consists of several forms. The first form contains a "list". Each list element represents a button. If the respective button is pressed, another form should appear in which one can enter the data for the list entry. Then the first form is displayed again (with updated list entries). Here is my attempt, which uses the library npyscreen but does not return to the first form. The code does also not contain the logic

Maximizing console window - C#

旧巷老猫 提交于 2019-12-09 08:05:45
问题 I'm working on a console application on C# and I need to open the console maximized. When I just hit the maximize button on the console window, it maximizes only on height and not in width. I tried to use the following code : Console.WindowWidth = 150; Console.WindowHeight = 61; Which works almost as I want on my computer but gives error on some other computers. What should I do to maximize the console? 回答1: Can't with the CLR. Need to import Win32 API calls and poke your container window.

what is the difference between win32 application, windows form application and console application?

爱⌒轻易说出口 提交于 2019-12-09 06:27:34
问题 I want to know what is the difference between windows form application, win32application ana console, i know that both the windows form application and win32 application is gui tool, but i want to know when to use one over the other one, and could I convert console application to windows form application ? 回答1: Windows Form refers to a .NET application. It's not based directly on the native Windows API, but instead on the .NET infrastructure. Which includes a virtual machine. Win32 generally

Convert keycode to char/string

牧云@^-^@ 提交于 2019-12-09 03:39:10
问题 I'm trying to convert System.Windows.Forms.Keys to string/char using : KeysConverter converter = new KeysConverter(); string text = converter.ConvertToString(keyCode); Console.WriteLine(text); But it returned "OemPeriod" for "." and "Oemcomma" for ",". Is there any way to get the exact character? 回答1: This is probably what you really want (bit late, but hope this will help someone else), converting the keycode directly to the character the key prints. First add this directive into your class:

Iterating until int.MaxValue reached

六眼飞鱼酱① 提交于 2019-12-09 03:21:12
问题 As a little test I wanted to see how long it would take to count to int.MaxValue in a C# console application. Every few hours I checked the progress. Last night when I thought the program would be done executing, it was executing back to 0. I'm not sure why that happened and I was wondering if anyone could explain it to me. What it did was that it counted to 2,147,483,647 then when this value was reached it began counting backwards to zero. Even though it appeared to be counting backwards,

How To Detect Language Changes While Runtime ? (C#)

青春壹個敷衍的年華 提交于 2019-12-08 19:28:35
问题 I want to detect when the user is changing his language on the keyboard. For example, I want to know if the user is using English, and then changing the language to French. I want to detect this change from all the active threads. I mean that I want to know when that change happens in the OS, And not in some specific thread.. I'm using C# language.(Console Application) Can Anyone help me to figure it out? I will be glad to some help.. Thank You. 回答1: If you develop using WinForms use