Page 42 - ePB316_最佳案例 Visual Basic 2017 程式設計
P. 42

Visual Basic 2017 程式設計




                    ɓeWrite ˙ج

                        Write ˙ج΍Ϟ 17 ၇ε༱d௅ʱε༱νɨྡהͪf

                                                          ਗ਼ܸ֛̺؍࠽€Booleanٙ˖οڌͪᄳɝᅺ๟፩̈
                           Write(Boolean)
                                                          ༟ࣘݴf

                           Write(Char)                    ਗ਼ܸ֛ٙ Unicode οʩ࠽ᄳɝᅺ๟፩̈༟ࣘݴf
                           Write(array<Char>^)            ਗ਼ܸ֛ٙ Unicode οʩ৬ΐᄳɝᅺ๟፩̈༟ࣘݴf
                           Write(array<Char>^, Int32, Int32)  ਗ਼ܸ֛ٙ Unicode οʩɿ৬ΐᄳɝᅺ๟፩̈༟ࣘݴf

                           Write(Decimal)                 ਗ਼ܸ֛ Decimal ࠽ٙڌͪ˖οᄳɝᅺ๟፩̈༟ࣘݴf
                                                          ਗ਼ܸ֛ٙᕐၚᆽܓओᓃᅰ࠽ٙ˖οڌͪᄳɝᅺ๟፩̈
                           Write(Double)
                                                          ༟ࣘݴf

                    ͉ఊʩසʧୗՇ၇˾ڌ׌ٙ˙جdʱй݊ Write(Short) ၾ Write(String, Object)f


                    1. Overloads Public Shared Sub Write(Short)

                      ʮ͜˙جd̙ਗ਼ Short ۨйٙ༟ࣘ፩̈fԷνj

                        Dim a As Short = 5
                        Console.Write(a)


                      ഐ؈݊ 5f
                    2. Overloads Public Shared Sub Write(String, Object)


                      Ϥ˙ج̙ਗ਼ܸ֛༟ࣘ˸ࣸόʷοЕ፩̈fԷνj

                        Dim a As Short = 50000
                        Dim b As Short = 20000
                        Console.Write("{0:c} {1:n}", a, b)


                      ٙ፩̈νɨf

                        NT$50,000.00     20,000.00

                      Չʕ {0:c} ၾ {1:n} ٙ 0 ၾ 1 ڌͪהࠅ              ୌ໮                ᗳйΤ၈

                      ࿁Ꮠٙ༟ࣘනҏ€ɪԷ a ٙනҏ݊ 0d                        C    ஬࿆ୌ໮
                                                                  D    ɤආЗ
                      b ݊ 1ic ၾ n ˾ڌ፩̈ࣸόd੬͜
                                                                  E    ߅ኪা໮
                      ٙ፩̈ࣸόν̛ڌהͪd˲ɽʃᄳே                            F    ʃᅰٙЗᅰfԷνjF5 ڌͪʃᅰ՟ 5 Зf
                      ൖމ޴Νf                                       N    ᜑͪɷʱЗ
                                                                  X    ɤʬආЗ
              34
   37   38   39   40   41   42   43   44   45   46   47