[Vb.net] Console progress bar example, vb.net example

Source: Internet
Author: User

[Vb.net] Console progress bar example, vb.net example

1 Private Sub ConsoleProcessBar () 2 Dim isBreak As Boolean = False 3 Dim colorBack As ConsoleColor = Console. backgroundColor 4 Dim colorFore As ConsoleColor = Console. foregroundColor 5' (0, 0) (Left, Top) the first line of 6 Console. writeLine ("************ TE Mason **************") 7 Console. backgroundColor = ConsoleColor. darkCyan 8 For I = 0 To Console. listen wwidth-3 9' () Second Line 10 Console. write ("") 11 Next12 '(0, 1) Line 2 13 Console. writeLine ("") 14 Console. backgroundColor = colorback15' (0, 2) the third line is 16 Console. writeLine ("0%") 17' () Row 4 18 Console. writeLine ("<Press Enter To Break>") 19 20 For I = 0 To 10021 If Console. keyAvailable AndAlso Console. readKey (True ). key = ConsoleKey. enter Then22 isBreak = True23 Exit For24 End If25 Console. backgroundColor = ConsoleColor. yellow26'/returns the complete quotient, including the remainder. SetCursorPosition is automatically rounded to 27 C. Onsole. setCursorPosition (I * (Console. required wwidth-2)/100, 1) 28 'msgbox (I * (Console. required wwidth-2)/100) 29' MsgBox (Console. cursorLeft) 30' MsgBox (Console. cursorSize) 31 Console. write ("") 32 Console. backgroundColor = colorBack33 Console. foregroundColor = ConsoleColor. green34 Console. setCursorPosition (0, 2) 35 Console. write ("{0} %", I) 36 Console. foregroundColor = colorFore37 Threading. thread. slee P (1000) 38 Next39 40 Console. SetCursorPosition (0, 3) 41 Console. Write (IIf (isBreak, "Break !!! "," Finish ") 42 Console. WriteLine (" ") 43 Console. ReadKey () 44 Console. ReadKey (True) 45 End Sub

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.