Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / February 2005

Tip: Looking for answers? Try searching our database.

VB.NET & C++.NET

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
survivor - 14 Feb 2005 18:33 GMT
When developing a console application how do I place the cursor at a specific
colomn and row?
Derrick Coetzee [MSFT] - 18 Feb 2005 23:03 GMT
> When developing a console application how do I place the cursor at a specific
> colomn and row?

If you're using the beta of the new .NET Framework 2.0, then you can use the
Console.SetCursorPosition() method to do this, or alternatively, assign the
properties Console.CursorLeft and Console.CursorTop. There's no
functionality in the .NET Framework 1.0 for this, but you can invoke the
Win32 API call SetConsoleCursorPosition() instead. This function should do
the trick:

void SetCursorPosition(int row, int col) {
   COORD coord;
   coord.X = col;
   coord.Y = row;
   SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
}

Make sure you "#include <windows.h>"; this should usually be put in
stdafx.h. In other languages like Visual Basic and C# you would need to use
DllImport to import the appropriate native calls. I hope this helps.
Signature

Derrick Coetzee, Microsoft Speech Server developer
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included code samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm


Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.