VB5 ªì¯Å¥Í ¦Ñ©Ç½d¨Ò(¥|)

¦^­º­¶


¤ÀÃþ

¼ÐÃD

¤j·N

§@ªÌ

¤é´Á

¤¸¥ó¨Ï¥Î ²©ö¤ë¾ä½d¨Ò Label °}¦CªºÅܤƹB¥Î ¦Ñ©Ç 1998/8/13
ª«¥ó¨Ï¥Î §R°£¦C¦L¤å¥ó Printer.KillDoc ªº¤èªk ¦Ñ©Ç 1998/8/18
ª«¥ó¨Ï¥Î ¥Î Collection ª«¥ó±Ò°Êªí³æ ¥Î¦r¦ê Load Form ¦Ñ©Ç 1998/8/18
ª«¥ó¨Ï¥Î ²©öÅwªïµe­± Logo Form ¦Ñ©Ç 1998/8/18
¹Ï§Î³B²z ¦p¦ó Paint ¥X³z©ú­I´º¹Ï RasterOp ±`¼Æªº¨Ï¥Î ¦Ñ©Ç 1998/8/13
ÅܼƳB²z °Æµ{¦¡»P°ïÅ| ¡@ CWW 1998/8/13
ÅܼƳB²z Åܼƭȿò¥¢ IsMissing() ¨ç¼Æªº¥Î³~ ¦Ñ©Ç 1998/8/13
ÅܼƳB²z ¦Û­q«¬ºAÅܼƳsÀô®M ¦h¼h¦Û­q«¬ºAÅÜ¼Æ ¦Ñ©Ç 1998/8/20
µ{¦¡©I¥s ÁקKµ{¦¡¦h¦¸°õ¦æ App.PrevInstance ªº¥Î³~ daisy 1998/8/13
¦r¦ê³B²z Åý´å¼Ð¦b TextBox ³Ì«á¤@¦æ ·í TextBox ¤º®e§ïÅÜ®É ¦Ñ©Ç 1998/8/13
¦r¦ê³B²z §â¦r¦ê©î¦¨°}¦C Len() & Mid() ¦Ñ©Ç 1998/8/15
¦r¦ê³B²z ¦b TextBox ùØ Format Text_Change & Format() ¦Ñ©Ç 1998/8/15
Àɮ׳B²z ¸ê®Æ§¨ªº½Æ»s FileCopy & MkDir ¦Ñ©Ç 1998/8/14
ÀÉ®×I/O ³v¦æ¼g¤J¦r¦ê Print # ³¯­zªº¨Ï¥Î ¦Ñ©Ç 1998/8/16
ÀÉ®×I/O VB ªºÀɮצs¨ú¼Ò¦¡ ¤£¦P®ÄªGªºÀɮצs¨ú ¦Ñ©Ç 1998/8/16
¬É­±¥~Æ[ »Pµøµ¡³s°Êªº Control Form_Resize ªº§Q¥Î ¦Ñ©Ç 1998/8/15
±`¼Æ«Å§i ¦b§Aªºµ{¦¡ùثŧi PI ­È ¡@ Kevin 1998/8/4
¿ù»~³B²z ª¾¿ù¤ñ¤£¿ù¦n Err ª«¥óªº¨Ï¥Î ¦Ñ©Ç 1998/8/22
¿ù»~³B²z ±N¿ù´N¿ù Resume Next ªº§®¥Î ¦Ñ©Ç 1998/8/22
µ{¦¡²z©À §Y®É¾Ô²¤¹CÀ¸ªº­ì²z Timer ªº¨Ï¥Î ¦Ñ©Ç 1998/8/17

VB5 ªì¯Å¥Í½d¨Ò¨Ï¥Î»¡©ú


  1. ¥»½d¨ÒÅwªï«DÀç§Q©Ê­Ó¤H¤Î²Õ´Âà¸ü¨Ï¥Î¡AÀç§Q¤§§Q¥Î½Ð¥ý¼x±o¥»¤H¤§¦P·N¡A¨Ó«Hµù©ú¨Ï¥Î¤è¦¡¤Î¦^ÂЦa§}¡C
  2. ¥»½d¨Ò©Ò¦³ªºµ{¦¡½X½d¨Ò¡A¬ÒÄݤQ¤À°ò¥»ªº VB »yªk¡A¦pªG±z¬O­Ó VB User ¡AÅwªïª½±µ¤Þ¥Î©Î§ï¼g¨Ï¥Î¦b§Aªºµ{¦¡¤¤ ¡A¥»¤H¤£¥D±iµÛ§@Åv¡A¦]¬°¡A¨S¿ìªk¬d¹À¡C
  3. ¦pªG§A¬O­Ó VB ªì¾ÇªÌ¡A¤S¦³ÂI½a½a(©M¦Ñ©Ç¤@¼Ë)¡A»°§Ö§â¥»­¶¥t¦s·sÀɨì§A¦Û¤vªººÏºÐ¡AÂ÷½u«áºCºC¬Ý¡A¤]¥i¥H Copy µ¹ªB¤Í³á(¤£¥i¥H¦¬¿ú)¡C
  4. ¥»½d¨Ò³£¬O¦Ñ©Ç´X­Ó¤ë¨Ó¦b tw.bbs.comp.language °Q½×¸s²Õ¤¤¦^µªª©¤Í°ÝÃDªº¦X¿è¡A¦]¬°¬O°w¹ï°ÝÃD¸Ñ¨M¡A©Ò¦³¨Ã¨S¦³¥þ­±Æ[©Àªº¸Ñ»¡¡A¤£¾A¦X§@¬°¤Jªù¤å³¹¡A¦ý¦pªG§AŪ¤F¤Jªù®Ñ¡A©Î¬O¤W¤F¦Ñ®vªº½Ò¡A¤ß¤¤¤´¤£¬Æ©ú¥Õªº¸Ü¡A´N¥i¥H¨Ó³o§ä§ä¦³¨S¦³§A­nªºµª®×¡A¦]¬°³o³£¬O§O¤H°Ý¹Lªº°ÝÃD¡C

¦^¯Á¤Þ


²©ö¤ë¾ä½d¨Ò


'------------  Cut Here  ----------------
VERSION 5.00
Begin VB.Form Form1
   Caption         =   "²©ö¤ë¾ä"
   ClientHeight    =   3945
   ClientLeft      =   4200
   ClientTop       =   2985
   ClientWidth     =   3885
   LinkTopic       =   "Form1"
   ScaleHeight     =   3945
   ScaleWidth      =   3885
   Begin VB.CommandButton cmdShow
      Caption         =   "½T©wÅã¥Ü"
      BeginProperty Font
         Name            =   "·s²Ó©úÅé"
         Size            =   9
         Charset         =   136
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   2520
      TabIndex        =   5
      Top             =   360
      Width           =   1095
   End
   Begin VB.TextBox txtMonthBox
      Height          =   270
      Left            =   1440
      TabIndex        =   4
      Text            =   "Text1"
      Top             =   600
      Width           =   735
   End
   Begin VB.TextBox txtYearBox
      Height          =   270
      Left            =   1440
      TabIndex        =   3
      Text            =   "Text1"
      Top             =   240
      Width           =   735
   End
   Begin VB.Label lblMonthTitle
      Caption         =   "½Ð¿é¤J¤ë¥÷"
      Height          =   255
      Left            =   240
      TabIndex        =   2
      Top             =   600
      Width           =   975
   End
   Begin VB.Label lblYearTitile
      Caption         =   "½Ð¿é¤J¦~¥÷"
      Height          =   255
      Left            =   240
      TabIndex        =   1
      Top             =   240
      Width           =   975
   End
   Begin VB.Label lblDay
      Caption         =   "Label2"
      Height          =   495
      Index           =   1
      Left            =   840
      TabIndex        =   0
      Top             =   2160
      Width           =   1215
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub cmdShow_Click()
    If Not IsNumeric(txtYearBox.Text) Then GoTo DateWrong
    If Val(txtYearBox.Text) < 0 Or Val(txtYearBox.Text) > 9999 Then GoTo
DateWrong
    If Not IsNumeric(txtMonthBox.Text) Then GoTo DateWrong
    If Val(txtMonthBox.Text) < 1 Or Val(txtMonthBox.Text) > 12 Then GoTo
DateWrong
    '°õ¦æ¶ñ¤J¤é´Á°Æµ{¦¡
    PutDay Val(txtYearBox.Text), Val(txtMonthBox.Text)

    Exit Sub

DateWrong:

    MsgBox "§A¤é´Á®æ¦¡¿é¤J¿ù»~", vbOKOnly, "¤é´Á¿ù»~"
    '¦b¤å¦r®Ø¶ñ¤W¤µ¤Ñªº¦~¥÷
    txtYearBox.Text = Year(Date)
    '¦b¤å¦r®Ø¶ñ¤W¤µ¤Ñªº¤ë¥÷
    txtMonthBox.Text = Month(Date)

    '°õ¦æ¶ñ¤J¤é´Á°Æµ{¦¡
    PutDay Val(txtYearBox.Text), Val(txtMonthBox.Text)
End Sub
Private Sub Form_Load()
Dim I As Integer
Dim XPos As Single, YPos As Single
Dim ColorChoice As Integer
    '³]©w¤é´Á¼ÐÅҮ榡
    With lblDay(1)
        .Alignment = 2
        .BackColor = RGB(255, 255, 255)
        .BorderStyle = 1
        .FontSize = 12
        .FontBold = True
        .Width = 495
        .Height = 375
        .Caption = ""
    End With

    '³]©w²Ä¤@­Ó¤é´Á¼ÐÅÒ¦ì¸m
    XPos = 240
    YPos = 1080
    lblDay(1).Move XPos, YPos
    XPos = XPos + lblDay(1).Width

    '¸ü¤J¨ä¾l¼ÐÅÒ¡A¨Ã³]©wÅã¥Ü¦ì¸m
    For I = 2 To 49
        Load lblDay(I)
        lblDay(I).Move XPos, YPos
        lblDay(I).Visible = True
        XPos = XPos + lblDay(1).Width
        If I Mod 7 = 0 Then
            XPos = 240
            YPos = YPos + lblDay(1).Height
        End If
    Next

    '³]©w¬P´ÁÅã¥ÜÃC¦â
    For I = 1 To 49
        ColorChoice = I Mod 7

        Select Case ColorChoice
            Case 0
                lblDay(I).ForeColor = RGB(0, 255, 0)
            Case 1
                lblDay(I).ForeColor = RGB(255, 0, 0)
            Case Else
                lblDay(I).ForeColor = RGB(0, 0, 255)
        End Select
    Next

    'Åã¥Ü¤é´Á¼ÐÃD
    lblDay(1).Caption = "¤é"
    lblDay(2).Caption = "¤@"
    lblDay(3).Caption = "¤G"
    lblDay(4).Caption = "¤T"
    lblDay(5).Caption = "¥|"
    lblDay(6).Caption = "¤­"
    lblDay(7).Caption = "¤»"

    '¦b¤å¦r®Ø¶ñ¤W¤µ¤Ñªº¦~¥÷
    txtYearBox.Text = Year(Date)
    '¦b¤å¦r®Ø¶ñ¤W¤µ¤Ñªº¤ë¥÷
    txtMonthBox.Text = Month(Date)

    '°õ¦æ¶ñ¤J¤é´Á°Æµ{¦¡
    PutDay Val(txtYearBox.Text), Val(txtMonthBox.Text)

End Sub
Private Sub PutDay(ByVal YearValue As Integer, _
        ByVal MonthValue As Integer)
Dim LastDay As Integer, FirstWeekDay As Integer
Dim I As Integer

    '­pºâ¨C¤ë³Ì«áªº¤@¤Ñ¬O´X¸¹
    LastDay = Day(DateSerial(YearValue, MonthValue + 1, 0))
    '­pºâ¨C¤ëªº²Ä¤@¤Ñ¬O¬P´Á´X
    FirstWeekDay = WeekDay(DateSerial(YearValue, MonthValue, 1), 0)

    '²M±¼¤W¤@¦¸ªºÅã¥Ü
    For I = 8 To 49
        lblDay(I).Caption = ""
    Next

    'I ±q 7 ¶}©lªí¥ÜÁ׶}¬P´Á¼ÐÃD¼ÐÅÒ
    For I = 7 To LastDay + 6
        lblDay(I + FirstWeekDay).Caption = I - 6
    Next
End Sub
'-------------  End Here ----------------

¦^¯Á¤Þ


¦p¦ó Paint ¥X³z©ú­I´º¹Ï


¬q ÅA ¼¶¼g©ó¤å³¹

¥Î Paintpicture¤èªk¦³­Ó°ÝÃD...§Ú­ì¥»§Q¥Îgif¯S©Ê©Ò³y¥X¨Óªº³z©ú­I´º, ³z©úªº³¡¥÷³£³Q¶ñ¤W¥Õ¦â¤F..½Ð°Ý¦³¨S¦³¤èªk¯à«O«ù­ì¥ý³z©úªº®ÄªG..

¦Ñ©Çµª¡G

  1. §Ú­«´ú¤F¤@¹M¡APaintpicture ¤èªk¨S¦³°ÝÃD¡A¦b WMF ©M ICO Àɳ£¯à¶¶§Q¥h­I¡A¥u¦³ GIF ¥h­I¹Ï®æ¦¡¦³°ÝÃD¡A¦A¤@¦¸ MS ¤S¥Ç¤F¦Ñ¤ò¯f¡A¦b¸¹ºÙªº·s¼W¥\¯à¤W¡A¨ä¹ê¥\¯à¤ä´©ªº¤£§¹¾ã¡C
  2. ¦pªG§Aı±o  ICO Àɮ榡­­¨î¤Ó¤j¡A§A¥i¥H¦Û»s MetalFile(WMF ÀÉ)¡A¦Ñ©Ç½d¨Ò²Ä¤G¿è¦³±Ð§A¦p¦ó¦Û»s MetalFile¡C
  3. ¦pªG§A¤´Ä±±o WMF ¤£¯à¦p§Aªº·N¡A¥u¦³±Ä¥Î¦Ñ©Çªº³Ì«á¤@©Û¡A·Ç³Æ¨â±i«e´º§¹¥þ¬Û
    ¦P¡A­I´º¤@¶Â¤@¥Õªº¨â±i¹Ï[­n½T©w¬O RGB(0,0,0) ¤Î RGB(255,255,255)¡ABMP©ÎGif
    ¬Ò¥i¡AJPG ¨Ã¤£¾A¦X)¡AµM«á°õ¦æ¤U¦C°Ê§@¡G
    Option Explicit

    Private Sub Command1_Click()
        '¨Ó·½¹Ï»P¥Øªº¹Ï°µ And ¥¬ªL¹Bºâ
        Me.PaintPicture Picture1.Picture, 100, 100, , , , , , , vbSrcAnd
        '¨Ó·½¹Ï»P¥Øªº¹Ï°µ Or ¥¬ªL¹Bºâ
        Me.PaintPicture Picture2.Picture, 100, 100, , , , , , , vbSrcPaint
    End Sub

    Private Sub Form_Load()
        '¸ü¤J¥Õ­I«e´º¹Ï
        Set Picture1.Picture = LoadPicture("c:\temp\white.bmp")
        '¸ü¤J¶Â­I«e´º¹Ï
        Set Picture2.Picture = LoadPicture("c:\temp\black.bmp")
        '¸ü¤J Container ­I´º¹Ï
        Set Me.Picture = LoadPicture("e:\image\07.jpg")
    End Sub
  4. vbSrcAnd or vbSrcPaint ´N¬O©Ò¿×ªº RasterOP °Ñ¼Æ¡A¦@¦³¤Q¤T¶µ¡A¥i¥HÅܤƥXªº®ÄªG¤Q¤À½ÆÂø¡A§A¦³ªÅ¥i¥H¹ï·Ó VB Help ªº»¡©ú¦Û¤v¸Õ¬Ý¬Ý¡A¦b³oùاA¥u­n°O¦í¤U¦C´X¶µ­ì«h¡G

¦^¯Á¤Þ


°Æµ{¦¡»P°ïÅ|


³o¬O¤@­Ó«Ü¤Ö³Q½Í°_ªº°ÝÃD¡A¦ý¤£ªí¥Ü¤£­«­n¡A¦p§A¹ï¥»½gÆ[©À¤´¦³ºÃ°Ý¡A½Ð¦V CWW ½Ð±Ðhttp://sunh.hosp.ncku.edu.tw/~cww/¡C

¦Ñ©Ç©ó 1998/8/11¡G

§Ú¦pªG¥Î¤U¦Cµ{¦¡½X¼ÒÀÀ·Æ¹«³sµo°Ê§@¡A«h«ö¤U·Æ¹«±Ò°Ê°j°é¡A©ñ¶}·Æ¹«´N°±¤î°j°é¡A¤@¤Á¦p§Ú¹w´Á¡G
Dim Working As Boolean
Private Sub ContinueClick()
Dim I As Long
    Do While Working
        I = I + 1
        Label1.Caption = I
        DoEvents
    Loop
End Sub
Private Sub Command1_MouseDown(Button As Integer, Shift As Integer, X As
Single, Y As Single)
    Label1.Caption = ""
    Working = True
    ContinueClick
End Sub
Private Sub Command1_MouseUp(Button As Integer, Shift As Integer, X As
Single, Y As Single)
    Working = False
End Sub

¦ý¦pªG§Ú¥Î¤U¨Ò¡A«h©ñ¶}·Æ¹««á¡A°j°é¤£·|°±¤î¡G

Private Sub ContinueClick(byval Working as boolean)
Dim I As Long
    Do While Working
        I = I + 1
        Label1.Caption = I
        DoEvents
    Loop
End Sub
Private Sub Command1_MouseDown(Button As Integer, Shift As Integer, X As
Single, Y As Single)
    Label1.Caption = ""
    ContinueClick true
End Sub
Private Sub Command1_MouseUp(Button As Integer, Shift As Integer, X As
Single, Y As Single)
    ContinueClick False
End Sub

¦ü¥G¦b°j°é¤¤ªºµ{¦¡¡A¦b¥¼µ²§ô«e¸ò¥»¤£²z·|¶Ç¶i¨Óªº°Ñ¼Æ¡A©Î¬O¥t¦³­ì¦]¡A½Ðª¾¹Dªº¤H´À§Ú¸Ñ´b¤@¤U¡C

CWW ©ó 1998/8/12¡G

©I¥sContinueClick False®É¡A¥Nªí¥t¥~°_¤@­Óstack ¦b°µContinueClickªº¨Æ¡A©Ò¥H¥¦¤@©lworking = false©Ò¥H´Nµ²§ô¤F¡A¦ÓContinueClick Trueªº¨º¤@¬qµ{¦¡½XÁÙ¦b°õ¦æ¡A©Ò¥H¤£·|°±¡A±z¥i¥HDebug¬Ý¤@¬Ý´Nª¾¹D¡A¤¤Â_ÂI¦bContinueClick False¦Ó«á«öF8¡C§_«h¡A½Ð§ï¥Î¥H¤U¤è¦¡´N¥i¥H

Private Sub ContinueClick(ByVal Working As Boolean)
Dim I As Long
Static conti As Boolean
conti = Working
    Do While conti
        I = I + 1
        Label1.Caption = I
        DoEvents
    Loop
End Sub
Private Sub Command1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Label1.Caption = ""
    ContinueClick True
End Sub
Private Sub Command1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
ContinueClick False
End Sub

¦Ñ©Ç©ó 1998/8/12

Private Sub ContinueClick(ByVal Working As Boolean)
Dim I As Long
Static conti As Boolean
'¬°¦ó¥[³o­Ó´N¥i¥H«¨¡AÁÙ¬O¤£¤ÓÀ´¡C
conti = Working
'........................................
End Sub

CWW©ó 1998/8/13

static ¨Ã¤£¬O©ñ¦b°ïÅ|¤ºªºÅܼơA©Ò¥H¤@¸g³]©w¡A¤£¦ý¼vÅTContinueClick Falseªº¨º¤@¨Sµ{¦¡½X¡A³s¦PContinueClick true©Ò¤Þµoªº¨º¬qµ{¦¡¤]¦]conti = false¦Ó¥O°j°é¤¤¤î¡C

¦Ñ©Çªº²z¸Ñ¡G

  1. °Æµ{¦¡ªºÅܼƸê®Æ¬O¦b³Q©I¥s«á¡A¤~Á{®Éµ¹¤@­Ó°ïÅ|¡A©ñ¸m°Æµ{¦¡©Ò»Ý¸ê®Æ¡C
  2. ÁöµM§Ú­Ì¬O©I¥s¦P¤@­Ó°Æµ{¦¡¡A¦ý­Y¤@­Ó°Æµ{¦¡³Q¦P®É©I¥s¨â¦¸¡A¥¦¬O¦U¦³¦Uªº°ïÅ|¡A¤£·|¦@¥Îªº¡C
  3. °Æµ{¦¡¤¤ªºÀRºAÅܼơA¨Ã¤£¬O©ñ¤J°ïÅ|¤¤¡A¦Ó¬O¥t¦³©T©w¦s©ñ¦ì¸m¡A©Ò¥H¤~¯à¦b°Æµ{¦¡µ²§ô«á¡A¤´«O¦³¨ä­È¡C
  4. ·PÁ CWW ¹ï¦Ñ©Ç³oºØ¥b¦Q¤lµ{¦¡¤Hªº«ü¾É¡C

¦^¯Á¤Þ


ÁקKµ{¦¡¦h¦¸°õ¦æ


(¤p®¦) ªº¤å³¹¤¤´£¨ì:

§Ú¥Î VB ¼g¤F¤@­Óµ{¦¡¡I­n«ç»ò§PÂ_µ{¦¡¤w¸g°õ¦æ¤F©O¡H

daisy¡G

¦bform load ¤¤¥[¤J

If App.PrevInstance = True Then  'ÁקKµ{¦¡¦h¦¸°õ¦æ
        End
End If

¦^¯Á¤Þ


Åܼƭȿò¥¢


±H¥óªÌ: ¦ó©Ó¿o

¤°»ò¬O if Not IsMissing() then

¦Ñ©Çµª¡G

  1. IsMissing() ¬O­ÓÀˬdÅܼƫ¬ºAªº¨ç¼Æ¡A¥¦³Ì²³æªº¸ÑÄÀ´N¬OÅܼƫ¬ºA¿ò¥¢¡A¤]´N¬O¥»¨Ó¥¦¥i¥HÂǥѫü©wªº±Ô­z¦¡«ü©w¬YÅܼƫ¬ºA¡Aµ²ªG³o­Ó°Ê§@¨S¦³³Q°õ¦æ¡A´N²£¥Í¤F IsMiissing ªºª¬ºA¡A¶Ç¦^­È¬O True or False¡C

  2. Å¥¤£À´¡A¨SÃö«Y¡A¤£­n»¡§A¬Ýªº¤H¬Ý¤£À´¡A§Ú¼gªº¤H¤@¼Ë¬Ý¤£À´¡A¦pªG§A¬Oµ{¦¡»y¨¥ªì¾ÇªÌ¡A·|À´¨º¬O¤Ñ¤~¡C

  3. ¦]¦¹¤£Á¿¤Ó¦h²z½×¡A¥uÁ¿¹ê»ÚÀ³¥Î¡A§Ú­Ì¥i¥H¥u°Ý IsMissing() ³o¨ç¼Æ¨ì©³¤°»ò®É­Ô·|False¡A¤°»ò®É­Ô·| True¡C

  4. ¤°»ò®É­Ô IsMissing()=True¡G

¦^¯Á¤Þ


Åý´å¼Ð¦b TextBox ³Ì«á¤@¦æ


Private Sub Command1_Click()
Text1.Text = "HoneyPie °Ý" + vbCrLf
Text1.Text = Text1.Text + _
"text1 ³o­Ó textbox ªº text ÄݩʧïÅܤF" + vbCrLf
Text1.Text = Text1.Text + _
"§Ú§Æ±æ´å¼Ð¯à¤@ª½¦b³Ì«á¤@¦æ" + vbCrLf
Text1.Text = Text1.Text + _
"¤£ª¾¹D«ç»ò°µ¨ì? ÁÂÁÂ"

Text1.SetFocus
End Sub


Private Sub Text1_Change()
'­«ÂI!!³o¼Ë¥i¥H§â¹C¼Ð©ñ¨ì Text ªºµ²§À
Text1.SelStart = Len(Text1.Text)
End Sub

Text1.MultyLine=true
text1.scrollbars=2
³o¨â­ÓÄÝ©Ê­n¥ý¦b³]­p¶¥¬q³]¦n¡A¦]¬°¥¦­ÌµLªk¥Îµ{¦¡±Ô­z¨Ó§ïÅÜ¡C

¦^¯Á¤Þ


¸ê®Æ§¨ªº½Æ»s


daisy ¼¶¼g©ó¤å³¹

½Ð°Ývb5.0¦p¦ó§â¤@­Ó¸ê®Æ§¨·h¨ì¥t¤@­Ó¦a¤è¥h¡AÁÙ¦³¦p¦óª¾¹D¤@­Ó¸ê®Æ§¨¬O§_³Q¦s¦b?

¦Ñ©Çµª¡G

Private Sub Command1_Click()
Dim SourcePath As String, TargetPath As String
Dim CheckString As String

    '³]©wÀɮ׽ƻs¤§¨Ó·½¤Î¥Øªº
    SourcePath = "c:\icons"
    TargetPath = "c:\tempb"

    'Àˬd¨Ó·½¸ô®|¬O§_¦s¦b
    CheckString = Dir(SourcePath, vbDirectory)
    '¤£¦s¦bÅã¥Ü MsgBox °T®§
    If CheckString = "" Then GoTo FileNotFound

    Me.MousePointer = 11

    'Àˬd¥Øªº¸ô®|¬O§_¦s¦b
    CheckString = Dir(TargetPath, vbDirectory)
    '¤£¦s¦b«h MkDir
    If CheckString = "" Then
        MkDir TargetPath
    End If

    '¬°¨Ó·½¸ô®|¦r¦ê§À¥[ "\" ¦r¦ê(¤~¯à¦V¤U·j´M)
    If Right(SourcePath, 1) <> "\" Then
        SourcePath = SourcePath + "\"
    End If

    '¬°¨Ó·½¸ô®|¦r¦ê§À¥[ "\"
    If Right(TargetPath, 1) <> "\" Then
        TargetPath = TargetPath + "\"
    End If

    '­«·s³]©w¤@¦¸ Dir ±Ò©l¸ô®|
    CheckString = Dir(SourcePath)

    '§ä¤£¨ìÀɮפF¤~µ²§ô
    Do While CheckString <> ""
        If Not (CheckString = "." Or CheckString = "..") Then
            FileCopy SourcePath & CheckString, TargetPath & CheckString
            CheckString = Dir
        End If
    Loop

    Me.MousePointer = 0

    Exit Sub
FileNotFound:
    MsgBox SourcePath & " ¥Ø¿ý¤£¦s¦b", vbOKOnly, "Àɮ׸ô®|¿ù»~"

End Sub

¥H¤W¥u¬O¤@¼h¥Ø¿ýªºÀÉ®× Copy ¡A­Y­n§t©Ò¦³¤U¼h¤l¥Ø¿ýÀɮסA½Ð¨ìCWW http://sunh.hosp.ncku.edu.tw/~cww/ VB¤ß±oµ§°O§ä¤@½g¤l¥Ø¿ýÀÉ®×·j´Mªº½d¨Ò¡C

¦^¯Á¤Þ


§â¦r¦ê©î¦¨°}¦C


«i´±ªº®ü¤ý¤l ¼¶¼g©ó¤å³¹

¦pªG§Ú·Q§âtext1.text³]¦¨¤@­Ó¦r¦ê°}¦C¡A¬O¤£¬Oª½±µ¼g¦¨

¦Ñ©Çµª¡G

§A³o¼Ëªº¼gªk¬O«Å§iªø«×¬° 11 (1~10) ªº¤@­Ó°}¦C¡A¨Ã§â Text1.Text ©ñ¶i²Ä¤Q¤@­Ó°}¦CùØ¡A¨Ã¤£¬O§â Text1.Text ©î¦¨³æ¦r©ñ¦b S() ùتº·N«ä¡A­n°µ¨ì©î¦r¦ê¡A½Ð°Ñ¦Ò¤U¨Ò¡G

Dim S() As String * 1
Private Sub Command1_Click()
Dim I As Long
    For I = 0 To Len(Text1.Text)
        ReDim Preserve S(I)
        S(I) = Mid(Text1.Text, I + 1, 1)
        Print S(I)
    Next
End Sub

ÂÇ¥Ñ S() °ÊºA°}¦C«Å§i¡A¤Î Redim S() °}¦Cªø«×¡A¥i¥H°µ¥X­è¦n²Å¦X Text1.Text ªø«×ªº°}¦C¡C

¦^¯Á¤Þ


»Pµøµ¡³s°Êªº Control


ªü§Ó ¼¶¼g©ó¤å³¹

½Ð°Ý§Ú¦p¦ó³]­pµ{¦¡¡A¨Ï±o§Úªºµøµ¡¤º®e¤]·|¸òµÛ§ïÅÜ¡C¨Ò¦p·í§Ú§ïÅܵøµ¡¤j¤p®É¡A§Ú­nµøµ¡¤ºªºFRAME,PICTURE,TOOLBAR¤]¸òµÛ¤ñ¨Ò§@¥Î¡C

¦Ñ©Çµª¡G

  1. Option Explicit

    Dim OldWidth As Single
    Dim OldHeight As Single

    Private Sub Form_Load()
    '°O¿ý­ì¨Ó Form ªºªø¡B¼e
    OldWidth = Me.ScaleWidth
    OldHeight = Me.ScaleHeight
    End Sub

    Private Sub Form_Resize()
    Dim XScale As Single
    Dim YScale As Single
    Dim I As Integer

    '´«ºâ­ìµøµ¡¤j¤p»P·sµøµ¡¤j¤pªº¤ñ¨Ò
    XScale = Me.ScaleWidth / OldWidth
    YScale = Me.ScaleHeight / OldHeight

    '¦p¸Ó±±¨î¶µ¨S¦³ Font ÄÝ©Ê«h¸õ¤U¤@­Ó
    On Error Resume Next
    '²¾°Ê¨Ã½Õ¾ã±±¨î¶µ¤j¤p
    For I = 0 To Me.Controls.Count - 1
    With Me.Controls(I)
    Select Case TypeName(Me.Controls(I))
    Case "Line"
    .X1 = .X1 * XScale
    .X2 = .X2 * XScale
    .Y1 = .Y1 * YScale
    .Y2 = .Y2 * YScale
    Case Else
    .Move .Left * XScale, .Top * YScale, _
    .Width * XScale, .Height * YScale
    .FontSize = .FontSize * (XScale + YScale) / 2
    End Select
    End With
    Next
    '°O¿ý·sµøµ¡¤j¤p
    OldWidth = Me.ScaleWidth
    OldHeight = Me.ScaleHeight
    End Sub
  2. ¦p¦ó»Pµøµ¡³s°Ê Control¡A®£©È¥Ã»·¤£·|¦³¤@­Ó³qÅé¾A¥Îªº¿ìªk¡A¦]¬°¨C­Ó¤¸¥ó³Q³]­p®v»s¦¨®É¡A¦pªG±Ä¥Î¤F¤£¦P©ó¤@¯ë VB ±±¨î¶µªº¥~Æ[½Õ¾ã¼Ò¦¡¡A´Nªí¥Ü§A¥²¶·¦h³B²z¤@ºØ¨Ò¥~ª¬ªp¡C§Ú¦Ûª¾¦¹½d¨Ò¤£¬O¤@­Ó§¹¬üµª®×(¦]¬°¥Ã»··|¦³¨Ò¥~)¡A¦ý°_½X¥ý¸Ñ¨M¤@¨Ç¤j³¡¥÷ªº±±¨î¶µ½Õ¾ã¤u§@¡A¦A¨Ìªí³æ¨Ï¥Îªº¤¸¥ó§@¨Ò¥~³B²z¡A¥i¥H¨Ï³o­ÓÁcÂøªº°ÝÃD¥i¥H¦³­ÓµÛ¤âªº¤è¦V¡C

¦^¯Á¤Þ


¦b TextBox ùØ Format


¤G©j ¼¶¼g©ó¤å³¹

·Q½Ð±Ð¤@¤U ¦b TextBox Edit ´Á¶¡¶¶«Kformat¦p¦ó§@¡A¨Ò¦p ºV1234  ==> 1,234 ¦Ó¥B·|¥k¾a...

¦Ñ©Çµª¡G

Private Sub Text1_Change()
    Text1.Text = Format(Text1.Text, "#,###")
    Text1.SelStart = Len(Text1.Text)
End Sub

ª`·N¡G½Ð¥ý¦b³]­p¶¥¬q³]©w¦n

  1. Text1.Alignment=1
  2. Text1.Multiline=True

¦^¯Á¤Þ


³v¦æ¼g¤J¦r¦ê


Cheng Tom ¼¶¼g©ó¤å³¹

¦p¦ó±N¼Æ­Ó Label ¤¤ªº¸ê®Æ (Caption)¦s¤J¤@ .TXT ¼Ð·Ç®æ¦¡ªº¤å¦rÀɤ¤¡H

¦Ñ©Çµª¡G

Private Sub Command1_Click()
Dim FileHandle As Integer
Dim I As Integer
Dim PutString As String
    FileHandle = FreeFile

    Open "c:\temp\label.txt" For Output As #FileHandle

    For I = 0 To Label1.Count-1
        PutString = PutString + Label1(I)
    Next

    Print #FileHandle, PutString

    Close #FileHandle
End Sub

Private Sub Form_Load()
    Label1(0).Caption = "¦p¦ó±N¼Æ­Ó Label ¤¤ªº¸ê®Æ"
    Label1(1).Caption = "(Caption) ¦s¤J¤@ .TXT"
    Label1(2).Caption = " ¼Ð·Ç®æ¦¡ªº¤å¦rÀɤ¤¡H"
End Sub

¦^¯Á¤Þ


PI ­È


pony ¼¶¼g©ó¤å³¹

½Ð°Ý VB5 ¦³¨S¦³ PI ³o­Ó±`¼Æ

Kevin 榭G

¨S¦³¡A¤£¹L const pi = 3.14159265358979À³¸Ó¤w¸g¹Lºë½T¤F§a...§A¤]¥i¥H¥Îpi = 355/113 (±K²v¡A¤£¬O¨º»ò·Ç...)¡C

¦Ñ©Ç´¡ªá¡G

«Ø¤@­Ó MyOwn.bas¡A¦bùØ­±«Å§i Public Const user_PI As Double = 3.14159265358979¡A¦n¤F¡A¥H«á§Aªºµ{¦¡´N¥i¥H¦³ PI ³o­Ó±`¼Æ¤F¡C

¦^¯Á¤Þ


ª¾¿ù¤ñ¤£¿ù¦n


¦Ñ©Ç¡G

  1. ¦b VB 5.0 ¤º«Øª«¥óùØ¡A¦³¤@­Ó Err ª«¥ó¡A¥D­n¬O­t³dµ{¦¡°Ê§@°õ¦æ¿ù»~ªº°»´ú¡C¥¦ªº­ì²z´N¬O·í¥X²{µ{¦¡°Ê§@µLªk°õ¦æ¡A©Î¬O¨S¦¬¨ìÀ³¦³ªº°T®§®É¡A¦^À³µ{¦¡¤@­Ó°T®§¡A­n¨Dµ{¦¡¥[¥H³B²z¡A¦pªGµ{¦¡¤£³B²z¡A¥¦´N§âµ{¦¡µ²§ô¡A¥H§K¦M¤Î§@·~¨t²ÎªºÃ­©w¡C
  2. ©Î³\§A»¡¨º¼g­Ó²@µL¿ù»~ªºµ{¦¡¡A¤£´N¤£»Ý­n³o­ÓªF¦è¤F¶Ü¡H¨ä¹ê³o·Qªk¤£¤Á¹ê»Ú¡A¦]¬°À³¥Îµ{¦¡¥æ¨ì¨Ï¥ÎªÌ¤â¤W¡A¥¦ªº¾Þ§@¤£¥i¯à¤£¥X¿ù¡AÁ|¤Z³nºÐ¾÷ªù¨SÃö¡Bºô¸ô³s½u¹O®É¡A¸ê®Æ¶Ç°e¤¤Â_.....µ¥µ¥¡Aª¬ªp¦Ê¥X¡AµL©_¤£¦³¡C©Ò¥H°µ¬°¤@­Óµ{¦¡³]­p®v¤@¶}©l³]­pµ{¦¡´NÀ³¸Ó°²©w¨Ï¥ÎªÌ·|¥X¿ù¡AµM«á·Qªk¤l¸Ñ¨M³o¨Çª¬ªp¡C
  3. ­n¸Ñ¨M¿ù»~ª¬ªp¡A´N­n¾a Err ª«¥ó³qª¾¡A¦ý¦p¦ó¤~¦¬ªº¨ì Err ³qª¾¡H¨º´N­n¦b§Ú­Ìªº°Æµ{§ÇùØ¥[¤J On Error ±Ô­z¦p¤U¡G
    Private Sub Form_Load()
    On Error ..........
    'µ{¦¡±Ô­z.................
    End Sub
  4. On Error ¥Nªí§Ú­Ì­n±µ¦¬¿ù»~³qª¾¡A¦ý±µ¦¬¨ì­n«ç»ò³B²z©O¡H¤@¯ë³Ì±`¥Îªº¦³¤U¦C¨âºØ¡G
  5. On Error ¤£¥u¹ï¥¦«á­±¤@¦æªºµ{¦¡±Ô­z¦³®Ä¡A¦Ó¬O¹ï¾ã­Ó°Æµ{§Ç³£¦³®Ä¡A¤]´N¬O»¡§A¥u­n¦b Procedure ¶}©l°õ¦æ On Error ±Ô­z¡A°£«D¨ä«á¦³¥t¤@­Ó On Error ¨ú¥N¥¦¡A§_«h¾ã­Ó Procedure ³£±N¿í´` On Error «Å¥¬ªº³B²zªk«h¡C
  6. Err ª«¥ó³Ì¤è«K§Q¥Îªº¨â­ÓÄݩʬO Err.Number ©M Err.Description¡A§A¦b¿ù»~³B²z«e¥ý°õ¦æ Debug.print "¿ù»~¥N½X¡G" & Str(Err.Number) & " \ ¿ù»~±Ô­z¡G" & Err.Description ±N·|¨ó§U§A¤F¸Ñ°ÝÃDµo¥Íªºª¬ªp¤Î§P§O¤èªk¡C

¦^¯Á¤Þ


±N¿ù´N¿ù


¦Ñ©Ç¡G

¦^¯Á¤Þ


§Y®É¾Ô²¤¹CÀ¸ªº­ì²z


(inkfish)¤§»Ê¨¥¡G

  1. ª±¹L¬õ¦âĵ§Ù³oÃþ"§Y®É¾Ô²¤"ªºª±®a³£À³¸Óª¾¹D¥¦ªºª±ªk¡A¤]´N¬O§Ú¤è¥i¤£Â_²¾°Ê³æ¦ì¨Ó³¡ÄݩάO§@¾Ô¡A¦P¤@®É¶¡¤º¹q¸£©Ò±±¨îªºª±®a¤]¦P®É¶i¦æ³o¨â¶µ°Ê§@¡C
  2. °ÝÃD¨Ó¤F¡A°²¦p¤j®aÁÙ¨S§Ñ°Oªº¸Ü ·í®É¬õ¦âĵ§Ù¤W¥«®ÉÁÙ¬O 80486 CPU¡A¥[¤W DOS 6.xªº§@·~¨t²Î ´«¥y¸Ü»¡ ·í®ÉªºDOS ÁÙ¤£¬O¤@­Ó¦h¤uªº¨t²Î¡A¦ý¬O¬õ¦âĵ§Ùª±°_¨Ó«o·Ù¦³¨ä¨Æ ¦n¹³¦³¦h¤uªº¼Ë¤l(¾Ô¨®¥i¦Û¥Ñ²¾°Ê¤£¶·¹q¸£°Êª±¤~¯à°Ê ´«¨¥¤§ ¨S¦³¦^¦Xªº­­¨î)
  3. ©Ò¥H½Ð°Ý¤@¤U ­n¦p¦ó¦b¤@­Ó¨S¦³¦h¤uªº¨t²Î¤W¼ÒÀÀ¥X¤@­Ó¦h¤uªº¼Ë¤l?°²¦p§ï¦b²{¦bªº¦h¤u§@·~¥­¥x ¦pWIN95¥H¤Wªº¨t²Î­n¦p¦ó°µ¨ì¦¹¤@¥\¯à©O?thread¶Ü?

¦Ñ©Çµª¡G

³o¸ò¦h¤u¤°»òÃö«Y«¨¡A§O§â°ÝÃDÅͪº¨º»ò½ÆÂø¡C

  1. ³o¥s´Ñ¤l¾ÞÁa¼Ò¦¡¡C
  2. ¦^¦X¨î±Ä¥Î¤À§O´Ñ¤l¾ÞÁa¼Ò¦¡¡A¤]´N¬O¼Ä¤è´Ñ¤l¥Ñ¹q¸£¾ÞÁa¡A¨Ï¥ÎªÌ´Ñ¤l¥Ñ¨Ï¥ÎªÌ¾ÞÁa¡C
  3. §Y®É¨î±Ä¥Î²Î¦X´Ñ¤l¾ÞÁa¼Ò¦¡¡A¤]´N¬OÂù¤è´Ñ¤l³£¥Ñ¹q¸£¾Þ§@¡A¥u¬O¹q¸£¤¹³\¨Ï¥ÎªÌ§ïÅܧڤè´Ñ¤l¦æ¬°¼Ò¦¡¦Ó¤w¡C
  4. §Ú­Ì¥i¥H³o»ò·Q¡A¹q¸£¥Ñ¤@­Ó®É¶¡¾¹(Timer) ¹j¤@¬q®É¶¡¥h°Ê¤@¤U¼Ä§ÚÂù¤èªº©Ò¦³ºX¤l¡A¤]´N¬O»¡¨Ï¥ÎªÌ¦pªG¤£°Ê§@¡A¨ä¹ê´N¬O¬Ý¹q¸£¦Û¤v¦b¤U´Ñ¡C
  5. ¦ý¤@¥¹¨Ï¥ÎªÌ«ü©w¬Y´Ñ¤l®É¡A¸Ó´Ñ¤l²¾°Ê«ü¼Ð´N³Q¼Ð¬° False ¡A¦p¦¹¹q¸£¦b¨C¤@´Ñ¨B¤¤¸I¨ì¸Ó´Ñ¤l´N¤£·|¹ï¥¦¦³©Ò°Ê§@¡A¦ý¨ä¥L´Ñ¤l«hÄ~Äò°Ê§@¡Aª½¨ì¨Ï¥ÎªÌ³]©w§¹¸Ó´Ñ¤l¦æ°Ê¤è¦¡«á¡A¦æ°Ê«ü¼Ð«ì´_¬° True ¡A·N«ä´N¬OÄ~Äò¥æÁÙ¹q¸£±±ºÞ¡C
  6. ¥Î¤@­Ó³Ì²³æªº VB ¼Ò«¬¨Ó»¡©ú¡G

    Type ´Ñ¤l¼Ò¦¡
        ¦æ°Ê«ü¼Ð As Boolean
        ¦æ¬°¼Ò¦¡ As SomeValue
    End Type

    '°²³]¦³¤QÁû´Ñ¤l
    Dim ´Ñ¤l(9) AS ´Ñ¤l¼Ò¦¡

    Sub Form_Load()
    Dim I As Long

        ´Ñ¤l(0).¦æ¬°¼Ò¦¡=¼ÄA
        ´Ñ¤l(1).¦æ¬°¼Ò¦¡=¼ÄB
        .
        .
        ´Ñ¤l(5).¦æ¬°¼Ò¦¡=§ÚA
        ´Ñ¤l(6).¦æ¬°¼Ò¦¡=§ÚB
        .
        .
        For I=0 To Ubound(´Ñ¤l)-1
            ´Ñ¤l.¦æ°Ê«ü¼Ð=True
        Next
    End Sub

    Sub ´Ñ¤l_Click(Index As Integer)
        ´Ñ¤l(Index).¦æ°Ê«ü¼Ð=False
        Call ¦æ¬°¼Ò¦¡§ïÅÜ(Index)
    End Sub

    Sub ¦æ¬°¼Ò¦¡§ïÅÜ(Byval ¶Ç¤J­È)
        '...............¦æ¬°¼Ò¦¡§ïÅܳ]©w
        ´Ñ¤l(¶Ç¤J­È).¦æ¬°¼Ò¦¡ =·s¦æ¬°¼Ò¦¡
         ´Ñ¤l(¶Ç¤J­È).¦æ°Ê«ü¼Ð=True
    End Sub

    Sub Timer_Timer()
    Dim I As long
        For I=0 to UBound(´Ñ¤l)-1
            If ´Ñ¤l(I).¦æ°Ê«ü¼Ð=True Then
               Call ´Ñ¤l¦æ°Ê (´Ñ¤l(I).¦æ¬°¼Ò¦¡)
            End If
        Next
    End Sub

    Sub ´Ñ¤l¦æ°Ê(ByVal ¶Ç¤J­È)
        Select Case ¶Ç¤J­È
            Case ¼ÄA
                ¼ÄA ¼Ò¦¡¦æ°Ê®i¶}
            Case ¼ÄB
                ¼ÄB ¼Ò¦¡¦æ°Ê®i¶}
            .
            .
            Case §ÚA
                §ÚA ¼Ò¦¡¦æ°Ê®i¶}
            Case §ÚB
                §ÚB ¼Ò¦¡¦æ°Ê®i¶}
            .
            .
    End Sub

    ¦Ü©ó¾Ô¨®¶]´X¨B¡A¤h§Lµo´Xºj¡A³Q K ¦h¤Ö¤U¤~·|°}¤` ¡A¥i­É¦æ¬°¼Ò¦¡ªº¼W¥[¨Ó³]©w¡A¤£¹L³oºØ¦U§LºØ¤£¦PÄݩʪº³]©w¡A¤£ºÞ¦^¦X¨î©Î§Y®É¨î³£»Ý­n¦³¦¹ºØ¾÷¨î¡A¤£ºc¦¨Âù¤è¤À§Oªº­n¥ó¡C

#¤W¨Ò¯Â¬°¤@ºØºc·Q¼Ò¦¡¡A½Ð¤£­n§â³o¨Ç Copy ¨ì Form ùØ°õ¦æ¡C#

¦^¯Á¤Þ


§R°£¦C¦L¤å¥ó


±H¥óªÌ: richo

¤p§Ìªºµ{¦¡½X¦p¤U¡G
Private Sub CancelPrint_Click()
     printer.killdoc
end sub
±¡ªp¬O¡Gµ{¦¡°õ¦æ¤¤«ö¤U¦¹CancelPrint«öÁä«á¡A¦Lªí¾÷¨Ì¼Ë±N±ý¨ú®ø¦C¦L¤§¸ê®Æ¦L¥X¡C

¦Ñ©Çµª¡G

Printer.KillDoc ­n¦b Printer.EndDoc ¤§«e¤~¯à²×¤î¦C¦L¡A¤@¥¹§A EndDoc ¡A´N¨S¿ìªk¨ú®ø¤F¡A§A¥i¥H¤À§O´ú¸Õ EndDoc ¤§«eªº KillDoc¡A©M EndDoc ¤§«áªº KillDoc ¡A¨Ã§â¦Lªí¾÷µøµ¡¶}¦b®ÇÃä¡A§A´N·|¬Ý¥X¨âªÌ¤£¦P¤F¡C

¦^¯Á¤Þ


¥Î Collection ª«¥ó±Ò°Êªí³æ


¶³²H­·»´

¬O§_¥i¥H±Nformªºname¶Ç¨ì¤@­Ófunction¡AµM«áload³o­Óform©O¡H

¦Ñ©Çµª¡G

  1. ¥ý¥Î¤@­Ó Module ¼g¤J¤U¦C±Ô­z¡A¨Ã§â±M®×±Ò°Êª«¥ó§ï¬° Sub Main

    Option Explicit

    '«Å§i¤@­Ó¶°¦XÅܼơA·Ç³Æ§â©Ò¦³ªº±M®× Form ª«¥ó¥á¶i¨Ó
    Public FormCollect As New Collection

    Sub Main()
    Dim varForm As Form

        '¦b³oùؼg©ú§A±M®×¤¤©Ò¦³ªºªí³æ
        Set varForm = New Form1
        '§â Form1 ªº°Ñ·Óª«¥ó¥á¨ì FormCollect ¶°¦Xª«¥óùØ¡A
        '§â¯Á¤ÞÁä³]¬° Form.Name
        FormCollect.Add varForm, "Form1"

        Set varForm = New Form2
        FormCollect.Add varForm, "Form2"

        Set varForm = New Form3
        FormCollect.Add varForm, "Form3"

        '¨ú¥X Form1 °Ñ·Ó¡A°µ¬°²Ä¤@­ÓÅã¥Üªí³æ
        FormCollect.Item("Form1").Show
    End Sub
  2. ¦b§A²Ä¤@­ÓÅã¥Üªí³æùØ°µ¤U­±ªº±Ô­z¡A´N¥i¥H¥H¦WºÙ±Ò°Ê©Ò¦³ªí³æ

    Option Explicit

    '¨Ì¶Ç¤J¦r¦ê¨M©wªí³æ±Ò°Êªº°Æµ{§Ç
    Private Sub ShowForm(ByVal varFormName As String)
    Dim I As Integer

        '³vµ§®Ö¹ïªí³æ¬O§_¤w¸ü¤J
        For I = 0 To Forms.Count - 1
            '¦p¤w¸ü¤J«hĵ§i
            If Forms(I).Name = varFormName Then
                MsgBox "ªí³æ¤w¸ü¤J"
                Exit Sub
            End If
        Next

        '§â¦P¦Wªºªí³æ°Ñ·ÓÅã²{¥X¨Ó
        FormCollect.Item(varFormName).Show
    End Sub

    '¿ï¤@­Óªí³æ¸ü¤J
    Private Sub Combo1_Click()
        ShowForm Combo1.List(Combo1.ListIndex)
    End Sub

    Private Sub Form_Load()
    Dim I As Integer

        '§âªí³æ°Ñ·Ó¦WºÙ¥á¨ì Combo1 ùØ
        For I = 1 To FormCollect.Count
            'ª`·N¡A·í§A¤Þ¥Î¤@¥¼¸ü¤Jªí³æ¤§ÄݩʮɡA
            'ªí³æ·|¦Û°Ê¸ü¤J
            Combo1.AddItem FormCollect.Item(I).Name
        Next

        '§â¦Û°Ê¸ü¤Jªºªí³æ UnLoad ¡A¥H¸`¬Ù°O¾ÐÅé
        For I = 0 To Combo1.ListCount - 1
            '¦Û¤vªºªí³æ¤£­n UnLoad
            If Not Combo1.List(I) = Me.Name Then
                Unload FormCollect.Item(I + 1)
            End If
        Next
    End Sub

    Private Sub Form_Unload(Cancel As Integer)
        '±j­¢ªí³æÃö³¬
        UnLoad Me
    End Sub
  3. ³o¤@¬q²o¯A¤F«Ü¦h Forms ¤Î Form_Load ªº°ò¥»Æ[©À¡A¦Ñ¹ê»¡­n¤£¬O¶³²H­·»´³o»ò°Ý¡A§Ú¤]¤£·|·Q¨ì¥i¥H³o¼Ë°µ¡A§Ú¥i¥H³o»ò¸ò¤j®a»¡¡A¦b§Oªº±Ð¬ì®Ñ¤Î½Ò°óÁ¿¸q«Ü¤Ö³o»ò±Ðªº(©Î³\§Ú©tº|¹è»D¨S¬Ý¹L)¡A©Ò¥H½Ð¦U¦ìªì¾Çª©¤Í¤@©w¦Û¤v­n Copy ¤U¨Ó¸Õ¸Õ¬Ý¡A¦³¨º³¡¥÷¤£À´ Post ¤W¨Ó°Ý¡A§Ú¦A¸Ô²Ó¸ÑÄÀ¡A¦Ó¦¹¨Ò¤§©Ò¥H­«­n¡A¬O¦]¬°§A¥i¥H¥Î³oºØ¤è¦¡¡A¥H Name String »´©öªº¾ÞÁa¤j³¡¥÷ªº VB ª«¥ó¡A¦Ó¨º¨Çª«¥ó­n¥[¤J°Ê§@¡A¨º¨Çª«¥ó­n±Æ°£°Ê§@¡AÂÇµÛ Collection ªº Add ©M Remove ¥i¥H»´©ö¹F¦¨¡C
  4. Collection ¶°¦Xª«¥óÅܼƬO VB ùØ¥\¯à¶W¯Å±j¤jªºª«¥óÃþ«¬¡A¤£¥u¦³ Variant ªº¤°»òÅܼƳ£¥]ªº¯S©Ê¡A¤ñ Variant §ó±jªº¬O¥¦´£¨Ñ¤F°£ Index ¤§¥~ Key ­È¥i¨Ñ¨ú¥Xª«¥ó¤º®e¡A¦ý«Ü¤Ö¬Ý¨ì VB ª©¤Íªº Code ¦³¦b¥Î Collection ªº¡A¦pªG§AÁÙ¨S¥Î¹LCollection ¡A§Æ±æ§A»°§Ö½ Help ¡A¸ÕµÛ¨Ï¥Î¡C

¦^¯Á¤Þ


²©öªºÅwªïµe­±


¨«¹L¥|¤è¦^¨ì­ìÂI ¼¶¼g©ó¤å³¹

¹³¬OÅwªïµe­±µ¥ªí³æ §Ú·Q§â¥¦³]©w¦¨²Ä¤@±i­n«ç»ò°µ°Ú¡H

¦Ñ©Çµª¡G

  1. Option Explicit

    Private Sub Form_Load()
    Dim MyTime As Date
    Dim ShowString As String
        ShowString = "Åwªï¶i¤J" & vbCrLf & _
                "¨«¹L¥|¤èªº" & vbCrLf & _
                "¥@¬É"

        '½Õ¾ã form1 ¤j¤p
        With Me
            .FontSize = 36
            .Width = .TextWidth(ShowString) + 10 * Screen.TwipsPerPixelX
            .Height = .TextHeight(ShowString) + 10 * Screen.TwipsPerPixelY
            .Show
        End With

        '±j­¢ªí³æÅã²{¡A¤£µM·|¤£Åã¥Ü´Nµ²§ô¤F
        Me.Show
        Me.CurrentX = 5 * Screen.TwipsPerPixelX
        Me.CurrentY = 5 * Screen.TwipsPerPixelY
        '¨q¦r
        Me.Print ShowString

        MyTime = Timer
        '°±®æ¤T¬í
        Do While Timer - MyTime < 3
            DoEvents
        Loop

        Form2.Show
        Unload Me
    End Sub
  2. °O±o¥[¤J Form2 ¡AµM«á§â¤W­zµ{¦¡½X¥[¦b Form1 ùØ¡AForm1.BorderStyle ³Ì¦nµ¥©ó 0 ¡A®ÄªG·|¤ñ¸û¦n¡C·íµM¡AForm1 ¥u¬O¨q¤@¤U¦Ó¤w¡A©Ò¥H¤£­n¤Ó½ÆÂø¡A¥Dµ{¦¡©ñ Form2ùØ¡C

¦^¯Á¤Þ


¦Û­q«¬ºAÅܼƳsÀô®M


Äúµ§¤p¬P¬P ¼¶¼g©ó¤å³¹

½Ð°ÝVB5¤¤©w¸q¦Û­q«¬ºA¤¤¥i¤£¥i¦A©w¸q¥t¤@­Ó¦Û­qtype

¦Ñ©Çµª¡G

  1. ¥i¥H¡C
  2. ½Ð¬Ý½d¨Ò¡G
    Option Explicit

    Private Type First
        FirstName As String
        LastName As String
    End Type

    Private Type Second
        Name As First
        Salary As Long
        Age As Integer
    End Type

    Dim MyMan As Second

    Private Sub Form_Click()
        Print MyMan.Name.LastName + MyMan.Name.FirstName + _
                "¤µ¦~ " + Str(MyMan.Age) + " ·³¡A¨C¤ë¦¬¤J " _
                + Str(MyMan.Salary) + " ¤¸"
    End Sub

    Private Sub Form_Load()
        MyMan.Name.FirstName = "©Ç"
        MyMan.Name.LastName = "¦Ñ"
        MyMan.Age = 38
        MyMan.Salary = 0
    End Sub

¦^¯Á¤Þ


VB ªºÀɮצs¨ú¼Ò¦¡


±H¥óªÌ: James Wu

¥D¦®: ½Ð°Ý¡G±ý±N¦r¦ê¦s¤JÀɮפ¤¡A­n¦p¦ó°£¥h­º§ÀªºÂù¤Þ¸¹¡A¨ÏÂù¤Þ¸¹¤£¦s¤J©O¡H

¦Ñ©Çµª¡G

VB File I/O ¦³´XºØ¼Ò¦¡¬O¦¨¹ï¨Ï¥Îªº¡G

  1. Get# and Put# ÀH¾÷¦s¨ú
  2. Input# and Write# ´`§Ç¦s¨ú®æ¦¡¤Æ¤å¦rÀÉ
  3. LinePut# and Print# ´`§Ç¦s¨ú«D®æ¦¡¤Æ¤å¦rÀÉ
  4. InPut() ¨ç¼Æ¡A¸ü¤J¤@¤Á¤å¦rÀɧt®æ¦¡¤Æ¦r¤¸¡C
  5. §A¼gÀÉ·|¥[¤Þ¸¹À³¬O¥Î Write# ¼Ò¦¡¡A¦p¤£±ý®æ¦¡¤Æ½Ð¥Î Print#
  6. ½Ð¼ô±x¦UºØŪ¼g¤è¦¡ªº¤£¦P¡C

¦^¯Á¤Þ


¦^­º­¶

1