¤ÀÃþ |
¼ÐÃD |
¤j·N |
§@ªÌ |
¤é´Á |
¼ÆȳB²z | ¨D¨ú½è¼Æ | ¡@ | ¦Ñ©Ç | 1998/8/21 |
¼ÆȳB²z | ²©ö VB ¹Bºâ¾¹ | ¡@ | ¦Ñ©Ç | 1998/8/29 |
¼ÆȳB²z | ¤£«ÂЪº¶Ã¼Æ | ¡@ | ¦Ñ©Ç | 1998/9/4 |
¼ÆȳB²z | ¥Î And È°µ IF ±ø¥ó§PÂ_ | ¨î¹Bºâ»P¥]§t¹Bºâªº°Ï§O | ¦Ñ©Ç | 1998/9/4 |
ÅܼƹB¥Î | ¥Î For Each...In... °µ¦h Control ªº±±¨î | ¡@ | ¦Ñ©Ç | 1998/8/29 |
±±¨î¶µ³B²z | CommandButton ªº Color ÄÝ©Ê | ¡@ | ¦Ñ©Ç | 1998/8/29 |
±±¨î¶µ³B²z | ListBox ªº Item Move & Disabled | ¼ÒÀÀ VB ¤£´£¨ÑªºÄÝ©Ê©M¤èªk | ¦Ñ©Ç | 1998/9/9 |
±±¨î¶µ³B²z | ¤@ÓFrame¨â²Õ¥H¤Wªº Option Buttons | ¤S¤@Ó VB »Ù²´ªk | Peter | 1998/9/12 |
±±¨î¶µ³B²z | ¦b TextBox ùØ¿é¤J Chr(vbKeyTab) | ÄdºI Tab Áä | ¦Ñ©Ç | 1998/9/1 |
±±¨î¶µ³B²z | ©î¸Ñ¦h¦æ TextBox | ¡@ | ¦Ñ©Ç | 1998/9/1 |
±±¨î¶µ³B²z | TextBox ¿é¤J¼Æ¦r»P¤p¼ÆÂI | ¦b Text_Change ùتº§@ªk | ¦Ñ©Ç | 1998/9/14 |
±±¨î¶µ³B²z | ¦C¥X Container ®e¾¹ùتºª«¥ó | Container & Controls | ¦Ñ©Ç | 1998/9/14 |
ª«¥ó³B²z | ¦p¦ó¨ú±o¥Ø«ewindowsªº¹w³]¦Cªí¾÷È | ¡@ | ¦Ñ©Ç | 1998/8/29 |
ª«¥ó³B²z | ¤À¦C¤¤¤å¡B^¤å¦r«¬ | §A§Ñ¤F StdFont.Charset ¶Ü | ¦Ñ©Ç | 1998/9/20 |
¨Ï¥ÎªÌ¬É± | ¤@¶s±±¦h Form ªº¬É±³]p | ActiveForm Äݩʪº¨Ï¥Î | ¦Ñ©Ç | 1998/8/30 |
¨Ï¥ÎªÌ¬É± | ¦A½× ActiveForm ÄÝ©Ê | Screen & MdiForm | ¦Ñ©Ç | 1998/9/3 |
¨Ï¥ÎªÌ¬É± | ¦Û°Ê¤Á´« TextBox ªº¿é¤Jªk | ImeMode ªº¨Ï¥Î | ¦Ñ©Ç | 1998/9/1 |
¨Ï¥ÎªÌ¬É± | ½Õ°Ê Form ªº¤W¤U¦¸§Ç | SetFocus ¤èªk | ¦Ñ©Ç | 1998/9/3 |
¨Ï¥ÎªÌ¬É± | ¦p¦ó³B²z¤ñ¿Ã¹õ¤jªº Form | ±Ò¥Î MDIForm | ¦Ñ©Ç | 1998/9/14 |
ÀÉ®× I/O | ²©öÀH¾÷Àɽs¿è¾¹ | Random Àɮשµ¦ù§Q¥Î | ¦Ñ©Ç | 1998/9/4 |
Option Explicit
Private Function ¨D½è¼Æ(ByVal CalcNum As Long) As Variant
Dim I As Long, J As Long
Dim varRedimNum As Long
Dim ¾ã°£¼Æ As Boolean
Dim varReturn() As Long
If CalcNum < 1 Then
MsgBox "¿é¤J¼ÆȤ£¯à¤p©ó 1 ", vbOKOnly, "°Ñ¼Æ¿ù»~"
Exit Function
End If
'¥ý§â 1 ¸Ë¶i¶Ç¦^°}¦CùØ
ReDim varReturn(varRedimNum)
varReturn(varRedimNum) = 1
'¶Ç¤JȬO 1 ´N¤£©¹¤Uºâ
If CalcNum = 1 Then
¨D½è¼Æ = varReturn
Exit Function
End If
'¦^¶Ç°}¦C«ü¼Ð¥[ 1
varRedimNum = varRedimNum + 1
For I = 2 To CalcNum
For J = 2 To I
If J <> I Then
If (I Mod J) = 0 Then
¾ã°£¼Æ = True
Exit For
End If
End If
Next
If Not ¾ã°£¼Æ Then
ReDim Preserve varReturn(varRedimNum)
varReturn(varRedimNum) = I
varRedimNum = varRedimNum + 1
Else
¾ã°£¼Æ = False
End If
Next
¨D½è¼Æ = varReturn
End Function
'¨D½è¼Æ¨ç¼Æ©I¥s¤èªk
Private Sub Command1_Click()
Dim Accept
Dim I As Long
'¶Ç¤J°Ñ¼Æ 1000
Accept = ¨D½è¼Æ(1000)
'¿é¤JÈ¿ù»~«hµ²§ô
If IsEmpty(Accept) Then Exit Sub
'¦b ListBox ¤WÅã¥Üµ²ªG
For I = 0 To UBound(Accept)
List1.AddItem Accept(I)
Next
End Sub
©ñ¤@Áû¤ß... ¼¶¼g©ó¤å³¹
¦pªG«Ü¦hÓcontroln¦p¦ó¥h±±¨î©O??¨Ò¦p¦³20Ócheckbox,¤£§Æ±æ¨ú¦W±q1¨ì20...¥i¥H¥Îarrayªº¤è¦¡¶Ü??
¦Ñ©Çµª¡G
Option Explicit
Private Sub Command1_Click()
Dim Cont As Control
For Each Cont In Me.Controls
If TypeName(Cont) = "CheckBox" Then
Cont.Visible = Not Cont.Visible
End If
Next
End Sub
¤¦¡]BOY¡^ ¼¶¼g©ó¤å³¹
¦p¦óÅý¨Ï¥ÎªÌ¦b¤å¦r¤è¶ô¿é¤J¥ô·N¼ÆȤμƾǹBºâ¦¡«á¡A¥Ñ VB ¥[¥H¹Bºâ¡H
¦Ñ©Çµª¡G
Option Explicit
'FUnit ²Ä¤@¹Bºâ¤¸¡A
'CalcUnit ¹Bºâ¤l¡A
'LUnit ²Ä¤G¹Bºâ¤¸¡A
'°õ¦æ¦¹µ{¦¡½Ð©óªí³æ¥¬¸m 4 Ó TextBox ¤Î 1 Ó Command
'Text1->FUnit
'Text2->CalcUnit
'Text3->LUnit
'Text4->pºâµ²ªG¿é¥X
Private Function Operator(ByVal FUnit As Variant, _
ByVal CalcUnit As String, ByVal LUnit As Variant) As Variant
Dim ReValue As Variant
Select Case UCase(CalcUnit)
'¥H¤Uºâ³N¹Bºâ¤l¹Bºâ
Case "^"
ReValue = FUnit ^ LUnit
Case "*"
ReValue = FUnit * LUnit
Case "/"
ReValue = FUnit / LUnit
Case "\"
ReValue = FUnit \ LUnit
Case "MOD"
ReValue = FUnit Mod LUnit
Case "+"
ReValue = FUnit + LUnit
Case "-"
ReValue = FUnit - LUnit
'¥H¤U¤ñ¸û¹Bºâ¤l
Case "LIKE"
ReValue = FUnit Like LUnit
'¥H¤U³sµ²¹Bºâ¤l
Case "&"
ReValue = FUnit & LUnit
'¥H¤UÅÞ¿è¹Bºâ¤l
Case "AND"
ReValue = FUnit And LUnit
Case "EQV"
ReValue = FUnit Eqv LUnit
Case "IMP"
ReValue = FUnit Imp LUnit
Case "NOT"
ReValue = Not LUnit
Case "OR"
ReValue = FUnit Or LUnit
Case "XOR"
ReValue = FUnit Xor LUnit
'µL®Ä¹Bºâ¤l³B²z
Case Else
MsgBox "[" & CalcUnit & "] ¤£¬O¤@Ó¦³®Äªº¹Bºâ¤l", vbOKOnly _
, "¿é¤Jºâ¦¡¿ù»~"
Exit Function
End Select
Operator = ReValue
End Function
Private Sub Command1_Click()
Text4.Text = Operator(Text1.Text, Text2.Text, Text3.Text)
End Sub
Annie Chiu ¼¶¼g©ó¤å³¹ ...
¦Ñ©Çµª¡G
Option Explicit
'Àx¦s¦Lªí¾÷¸Ë¸m¦WºÙ¤§ÅܼÆ
Dim DriveString As String
Private Sub Form_Click()
Dim X As Printer
Print Printer.DeviceName
Print Printer.DriverName
For Each X In Printers
'§â¦Lªí¾÷³]©wµ¹»P¹w³]¦Lªí¾÷¤£¦P¦Wªº¨ä¥L¦Lªí¾÷
If X.DriverName <> DriveString Then
Set Printer = X
Exit For
End If
Next
Print Printer.DeviceName
Print Printer.DriverName
For Each X In Printers
'Àˬd DriveString ªºÈ¡A§â¹w³]¦Lªí¾÷§ì¦^¨Ó
If X.DriverName = DriveString Then
Set Printer = X
Exit For
End If
Next
Print Printer.DeviceName
Print Printer.DriverName
End Sub
Private Sub Form_Load()
'§â¹w³]¦Lªí¾÷ªº¸Ë¸m¦WºÙ©ñ¨ìÅܼÆùØ
DriveString = Printer.DriverName
End Sub
hsu shihchieh ¼¶¼g©ó¤å³¹
¦pªG§Ú·Q³]p¤@±Æ«ö¶s,¤Î¦h±i Form ¡A¦p¦óÅý VB ª¾¹D§Ú¶}¨ºÓ Form ¨Ã¦b MainForm ¤¤¾ÞÁa SubForm ùتº°Ê§@¡H
¦Ñ©Çµª¡G
- §A¦b MDIForm ¤W©ñ¤@Ó PictureBox¡A°µ¬° CommandButton ªº Container¡C
- ¦b Picturebox ¤W©ñ¤TÓ CommandButton.
- ¥[¤J Form1.MdiChild=true
- §â MDIForm ³]¬°±Ò°Êªí³æ¡A¨Ã§â¤U¦C±Ôz¶K¨ì MDIForm
Option Explicit
Private Sub Command1_Click()
Me.ActiveForm.Print "ABC"
End Sub
Private Sub Command2_Click()
Me.ActiveForm.Print "123"
End Sub
Private Sub Command3_Click()
Me.ActiveForm.Print "¦n²³æ"
End Sub
Private Sub MDIForm_Load()
Dim AForm As New Form1
Dim BForm As New Form1
Dim CForm As New Form1
AForm.Show
AForm.Caption = "AForm"
BForm.Show
BForm.Caption = "BForm"
CForm.Show
CForm.Caption = "CForm"
End Sub- ±Ò°Ê«á½ü¬yÂI A,B,CForm ¡A¦A«ö Command ¡A§A´N·|¬Ý¨ì®ÄªG¡C
bigcake ¼¶¼g©ó¤å³¹
¦b¤@Ó Form ¤¤¥[¤J¨âÓ (©Î¥H¤W) ªº TextBox,¦b Text1_KeyDown §ì¤£¨ì TAB Áä (vbKeyTab)why?¤Sn¦p¦ó¸Ñ¨M©O?
¦Ñ©Çµª¡G
Private Sub Text1_GotFocus()
Text1.IMEMode = 1
End Sub
Private Sub Text1_LostFocus()
Text1.IMEMode = 2
End Sub
CWW5 ¨Ó¨ç·N¨£¡G
ImeMode¦ü¥G¦³Bug¡A¦pªG¦³¦hÓTextBox³]¤FImeMode¨º·|¦³¤@¨Ç·N·Q¤£¨ìªº¶Ã¡C
¦Ñ©Ç·N¨£¡G
¦hÁ CWW5 ¡A¸g´ú¸Õªº½T¦³¦¹²{¶H¡A¦Ó¥B Text1_LostFocus() ¨Æ¥ó¤¤ªº Text1.IMEMode = 2 ±Ôz¦n¹³¤]¤£¥¿½T¡Aì¦]¤j·§¦b Mouse_Click ©M IMEMode Change °T®§¶Ç°e¤W¦³¨Ç°ÝÃD¡C©Ò¥H Text.IMEMode ¦n¹³¦b¨Æ¥ó³B²z¤W¦³¨º»ò¨Ç©_©Çªº·Pı¡C«OÀIªº§@ªk¬O¥u¨Ï¥Î¤@Ó TextBox ¡A¨Ã¥Ñ¥~³¡ª«¥óµ{§Ç¨ÓÅܧó Text.IMEMode ÄÝ©Ê¡C¨Ò¦p§Ú̦b¥Î Access 97 ®É¡A¦b¬Y¨Ç¿é¤JÄæ¦ì·|¦Û°Ê¤Á´«¿é¤Jª¬ºA¡A§Ú·Q VB ¥i¥H³o»ò¼ÒÀÀ¡G
Private Sub MSFlexGrid1_Click()
Text1.IMEMode = 2
With MSFlexGrid1
Text1.Move .CellLeft + .Left, .CellTop + .Top, .CellWidth, .CellHeight
Text1.Text = .Text
'¥Ñ Col ÄݩʧPÂ_²Ä´XÓÄæ¦ì¤Á´«¿é¤Jª¬ºA¡C
If .Col = 2 Then
Text1.IMEMode = 1
End If
Text1.SetFocus
End With
End Sub
¤ìÀY ¼¶¼g©ó¤å³¹
¦p¦ó±N¦h¦æTextBoxÂà´«¦¨ListBox
¦Ñ©Çµª¡G
¥»ÃD¸Ñªk«ÂI¦b TextBox ùتºÂ_¦æ¡A¥²¶·¥Ñ Chr(13)+Chr(10) ¨â¦r²Õ¦X°_¨Ó°õ¦æ¡A©Ò¥HÀ³¥H Chr(13) ¬°¤Á³Î§PÂ_ÂI¡G
Dim AllString As String
Dim SingleString As String
Dim SepString As String
Dim I As Long
AllString = Text1.Text
For I = 1 To Len(AllString)
SingleString = Mid(AllString, I, 1)
If SingleString = Chr(13) Then
'¹J¨ì Chr(13) «h§â¤À³Î¦r¦ê¥[¨ì ListBox ùØ
List1.AddItem SepString
SepString = ""
Else
If SingleString <> Chr(10) Then
'°£ Chr(10) ¥~³v¦r¥[¤J SepString ¤¤
SepString = SepString + SingleString
End If
End If
Next
'¥[¤J³Ì«á¤@Ó SepString
List1.AddItem SepString
CWW5 ¨Ó¨ç·N¨£¡G
©î¸Ñ¦h¦æ TextBox ³o¨î¦bMultiLine¦Ó¥B¦³Keyin Enter¨Ó´«¦æªºTextBox¡A¦pªGMultiLine¤§¤U¤@ª½KeyIn¤£´«¦æ¡A¨ì¤FTextBox³Ì¥kÃä«á¡A¦AKeyinªº¦r·|§é¤U¨Ó¡AÅܦ¨¥t¤@¦æ¡A³o¤è¦¡¸Ñ¨M¤£¤F¡A½Ð¬d¤@¤Uhtmapi101.htmªº°µªk¡C
¦Ñ©Ç·N¨£¡G
ÁÂÁ CWW5 ¡Aªº½T¬O¦p¦¹¡A¦pªG·Q¤À¸Ñ Mutiline ¦Û°Ê§é¦^ªº¦r¦ê¡A½Ð¨ì
http://sunh.hosp.ncku.edu.tw/~cww/htmapi101.htm °Ñ¦Ò CWW5 ªº°µªk¡C
±H¥óªÌ: kook
¦Ñ©Çµª¡G
¬q ÅA ¼¶¼g©ó¤å³¹
¦Ñ©Ç¡G
¨ä¹ê¥»½d¨Òªºì²z©Mªì¯Å¥Í½d¨Ò²Ä¤@¿è¡A¦p¦ó§âµP¬~´²¬~¶Ã¬O¦P¼Ëªº¡A¥u¬O¨º½d¨Ò§¨Âøªá¦â§PÂ_¡A¦A§Q¥Î©Ê¸û®t¡A©Ò¥H§Ú§ï¼g¤@¤U¡A§â¥¦°µ¦¨ Function ¡A¥i¥H«Ü¤è«Kªº¥Ñ§A¨M©wªº¶}©l¼Æ»Pµ²§À¼Æ¤¤¶¡ªº¼Æȶüƫ±Æ«á¡A¥H°}¦C§ÎºA°e¦^¡C´ú¸Õ¥»½d¨Ò½Ð©ó Form ¤W¥¬¸m Command1,List1¡C
Option Explicit
Private Function NoDoubleRnd(ByVal StartNum As Long, _
ByVal EndNum As Long) As Variant
Dim ReturnArray() As Long
Dim TempNum As Long, I As Long, J As Long
'¦pªG°_ÂI¼Æ¤j©ó²×ÂI¼Æ«h¨â¼Æ¹ï´«
If StartNum > EndNum Then
TempNum = EndNum
EndNum = StartNum
StartNum = TempNum
End If
'¨Ì¼ÆȤj¤p³]©w¶Ç¦^ Array ¤j¤p
ReDim ReturnArray(Abs(EndNum - StartNum))
'§â¤¤¶¡¼Æ¸Ë¶i¥h
For I = 0 To UBound(ReturnArray)
ReturnArray(I) = StartNum + I
Next
'±Ò°Ê¶Ã¼ÆºØ¤l
Randomize
'§Q¥Î Rnd «±Æ°}¦C
For I = UBound(ReturnArray) To 0 Step -1
'ÀH«ü¼ÐÁY´î°Ñ»P Rnd ªº°}¦C¤¸¯À
J = Int((I + 1) * Rnd)
'§âÀH¾÷«ü¨ìªº¤¸¯ÀÈ©ñ¨ì Buff
'¥H§Q´`§Ç¤¸¯ÀȤÎÀH¾÷¤¸¯Àȥ洫
TempNum = ReturnArray(J)
ReturnArray(J) = ReturnArray(I)
ReturnArray(I) = TempNum
Next
'¶Ç¦^¸g Rnd «±Æªº°}¦C
NoDoubleRnd = ReturnArray
End Function
Private Sub Command1_Click()
Dim Accept, I As Long
'²M°£Åã¥Üªº ListBox
List1.Clear
'©I¥s NoDoubleRnd ¦Ûq¨ç¼Æ¨Ã±µ¦¬¶Ç¦^È
Accept = NoDoubleRnd(0, 8)
For I = 0 To UBound(Accept)
List1.AddItem Accept(I)
Next
End Sub
¥»µ{¦¡½d¨Ò¥Ü½d¤F¥H¤U¤@¨Ç¤èªk¡G
¥H¨Ï¥ÎªÌ¦Ûq«¬ºAÅܼƶ}±Ò Random¡C
¦p¦ó¨ú±o°O¿ýÁ`µ§¼Æ¡C
¦p¦ó¬°°O¿ý¥[¤W§R°£°O¸¹¡C
¦p¦ó»s§@°O¿ý«ü¼Ð¾¹¡C
¦p¦ó²¾°£¥´¤W§R°£°O¸¹ªº°O¿ý¡C
VERSION 5.00
Begin VB.Form frmRandom
Caption
= "²©öÀH¾÷Àɽs¿è¾¹"
ClientHeight = 4170
ClientLeft =
60
ClientTop =
345
ClientWidth =
5445
LinkTopic =
"Form1"
ScaleHeight =
4170
ScaleWidth =
5445
StartUpPosition = 3 '¨t²Î¹w³]È
Begin VB.CommandButton btnClearData
Caption
= "²M°£§R°£°O¿ý"
Height
= 495
Left
= 2880
TabIndex
= 13
Top
= 3480
Width
= 2175
End
Begin VB.CommandButton btnDelete
Caption
= "§R°£"
Height
= 495
Left
= 2880
TabIndex
= 12
Top
= 2760
Width
= 2175
End
Begin VB.CommandButton btnAdd
Caption
= "·s¼W"
Height
= 495
Left
= 2880
TabIndex
= 11
Top
= 2040
Width
= 2175
End
Begin VB.CommandButton btnEdit
Caption
= "§ó·s"
Height
= 495
Left
= 2880
TabIndex
= 10
Top
= 1320
Width
= 2175
End
Begin VB.CommandButton btnDown
Caption
= "¤U¤@µ§"
Height
= 495
Left
= 4080
TabIndex
= 9
Top
= 600
Width
= 855
End
Begin VB.CommandButton btnUp
Caption
= "¤W¤@µ§"
Height
= 495
Left
= 2880
TabIndex
= 8
Top
= 600
Width
= 975
End
Begin VB.TextBox txtSalary
Height
= 375
Left
= 240
TabIndex
= 6
Top
= 3360
Width
= 1695
End
Begin VB.TextBox txtName
Height
= 375
Left
= 240
TabIndex
= 4
Top
= 2280
Width
= 1695
End
Begin VB.TextBox txtNo
Height
= 375
Left
= 240
TabIndex
= 2
Top
= 1200
Width
= 1695
End
Begin VB.Label Label5
Caption
= "û¤uÁ~¸ê"
Height
= 255
Left
= 240
TabIndex
= 7
Top
= 2880
Width
= 1695
End
Begin VB.Label Label4
Caption
= "û¤u©m¦W"
Height
= 255
Left
= 240
TabIndex
= 5
Top
= 1800
Width
= 1695
End
Begin VB.Label Label3
Caption
= "û¤u½s¸¹"
Height
= 255
Left
= 240
TabIndex
= 3
Top
= 720
Width
= 1695
End
Begin VB.Label Label2
Caption
= "Label2"
Height
= 255
Left
= 1680
TabIndex
= 1
Top
= 120
Width
= 1575
End
Begin VB.Label Label1
Caption
= "ÀÉ®×°O¿ý"
Height
= 255
Left
= 240
TabIndex
= 0
Top
= 120
Width
= 1215
End
End
Attribute VB_Name = "frmRandom"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Type MyType
'§R°£°O¿ýÄæ¦ì
Del As Boolean
No As Long
Name As String * 8
Salary As Single
End Type
'¶}Àɽs¸¹
Dim FileHandle As Integer
'¦s¨úÄæ¦ì¸ê®Æ¦ÛqÅܼÆ
Dim MyMan As MyType
'¹ê»ÚªºÁ`°O¿ý¼Æ
Dim RealNo As Long
'Á`°O¿ý¼Æ
Dim FileLength As Long
'²{¦b°O¿ý½s¸¹
Dim RecNo As Long
'«ü¼Ð°}¦C
Dim Pointer() As Long
'§R°£«ü¼Ð
Dim IsDelete As Boolean
Private Sub btnAdd_Click()
If Not (IsNumeric(txtNo.Text) And IsNumeric(txtSalary.Text))
Then
MsgBox "¿é¤J¸ê®Æ¿ù»~"
If RecNo <> 0
Then
DataShow
End If
GoTo ReEnabled
End If
'²{°O¿ý¥[ 1
RecNo = FileLength + 1
'¹ê»Ú°O¿ý¥[ 1
RealNo = RealNo + 1
'°O¿ý°}¦C¥[ 1
ReDim Preserve Pointer(FileLength)
'±N¹ê»Ú¬ö¿ýÈ¥[¨ì·s¤¸¯ÀùØ
Pointer(FileLength) = RealNo
'Á`°O¿ý¤]¥[ 1
FileLength = RecNo
DataSave
DataShow
ReEnabled:
If FileLength = 0 Then
NoRecord
Else
btnDown.Enabled =
False
If RecNo > 1 Then
btnUp.Enabled = True
End If
End If
txtNo.SetFocus
End Sub
Private Sub btnClearData_Click()
Dim TempHandle As Integer, I As Long
Dim TempMan As MyType
'¶}¼È¦sÀÉ
TempHandle = FreeFile
Open "c:\temp\test.tmp" For Random
As #TempHandle Len = Len(TempMan)
'µL°O¿ý«h¸õ¦Ü¿ù»~³B²zµ{§Ç
On Error GoTo ArrayInDexWrong
'±N¸ê®ÆÀÉ¥¼§R°£°O¿ý¼g¤J¼È¦sÀÉ
For I = 0 To UBound(Pointer)
Get #FileHandle,
Pointer(I), MyMan
TempMan.Del = False
TempMan.No = MyMan.No
TempMan.Name = MyMan.Name
TempMan.Salary = MyMan.Salary
Put #TempHandle, I + 1,
TempMan
Next
ArrayInDexWrong:
'Ãö³¬¸ê®ÆÀɤμȦsÀÉ
Close #TempHandle
Close #FileHandle
'¥Î¼È¦sÀÉÂл\¸ê®ÆÀÉ
FileCopy "c:\temp\test.tmp", "c:\temp\test.txt"
'§R°£¼È¦sÀÉ
Kill "c:\temp\test.tmp"
'§R°£«ü¼Ð°}¦C
Erase Pointer
'«·s¸ü¤J¸ê®Æ
LoadData
End Sub
Private Sub btnDelete_Click()
Dim I As Long
'³]§R°£«ü¼Ð¬°¯u
IsDelete = True
DataSave
'«±Æ«ü¼Ð°}¦C
If FileLength = 1 Then
Erase Pointer
Else
For I = RecNo To
FileLength
If I <> FileLength Then
Pointer(I - 1) = Pointer(I)
End If
Next
ReDim Preserve Pointer(FileLength
- 2)
End If
RecNo = RecNo - 1
FileLength = FileLength - 1
If FileLength = 0 Then
NoRecord
TextClear
ShowRec
Else
If RecNo = 0 Then
RecNo = FileLength
DataShow
End If
txtNo.SetFocus
End Sub
Private Sub btnDown_Click()
RecNo = RecNo + 1
DataShow
txtNo.SetFocus
End Sub
Private Sub btnEdit_Click()
DataSave
txtNo.SetFocus
End Sub
Private Sub btnUp_Click()
RecNo = RecNo - 1
DataShow
txtNo.SetFocus
End Sub
Private Sub Form_Load()
LoadData
End Sub
Private Sub Form_Unload(Cancel As Integer)
Close #FileHandle
End Sub
Private Sub DataShow()
'Ū¤J«ü¼Ð°}¦C¸ê®Æ
Get #FileHandle, Pointer(RecNo - 1), MyMan
txtNo.Text = MyMan.No
txtName.Text = MyMan.Name
txtSalary.Text = MyMan.Salary
If RecNo <> 1 Then
btnUp.Enabled = True
Else
btnUp.Enabled = False
End If
If RecNo <> FileLength Then
btnDown.Enabled = True
Else
btnDown.Enabled =
False
End If
ShowRec
OpenEdit
End Sub
Private Sub DataSave()
'¨Ì§R°£«ü¼Ð¨M©w Del ÄæÈ
MyMan.Del = IsDelete
MyMan.No = CLng(txtNo.Text)
MyMan.Name = txtName.Text
MyMan.Salary = CSng(txtSalary.Text)
Put #FileHandle, Pointer(RecNo - 1), MyMan
'±N§R°£«ü¼Ð´_¤¸
IsDelete = False
End Sub
Private Sub ShowRec()
Label2.Caption = RecNo & "/"
& FileLength
End Sub
Private Sub LoadData()
Dim I As Long, J As Long
FileHandle = FreeFile
Open "c:\temp\test.txt" For Random
As #FileHandle Len = Len(MyMan)
'°Oºâ¹ê»ÚÁ`°O¿ý¼Æ
RealNo = LOF(FileHandle) / Len(MyMan)
If RealNo <> 0 Then
For I = 1 To RealNo
Get #FileHandle, I, MyMan
'¥u§â¥¼§R°£°O¿ý©ñ¤J«ü¼Ð°}¦CùØ
If Not MyMan.Del Then
ReDim Preserve Pointer(J)
Pointer(J) = I
J = J + 1
End If
Next
End If
'¥¼§R°£°O¿ýÁ`¼Æµ¥©ó«ü¼Ð°}¦C¼Æ
FileLength = J
If FileLength = 0 Then
ShowRec
NoRecord
Else
RecNo = 1
DataShow
End If
End Sub
Private Sub NoRecord()
btnUp.Enabled = False
btnDown.Enabled = False
btnEdit.Enabled = False
btnDelete.Enabled = False
btnClearData.Enabled = False
End Sub
Private Sub OpenEdit()
btnEdit.Enabled = True
btnDelete.Enabled = True
btnClearData.Enabled = True
End Sub
Private Sub TextClear()
txtNo.Text = ""
txtName.Text = ""
txtSalary.Text = ""
End Sub
±H¥óªÌ: Jessie
ListBox¸Ì¦³¤@¨Ç¿ï¶µ,µM«á§Ú·QÂI¿ï¤@ӿﶵ,©¹¤W©Î¤U©ì¦², ÁÙ¦³¦pªG§Ú·QÅý Listbox¸Ìªº¨ä¤¤¤@ӿﶵDisable,¥i¥H¬Ý±o¨ì¨ºÓ¿ï¶µ,¦ýµLªkÂI¿ï¨ºÓ¿ï¶µ,¦Ó¥B¤]¥i¥H§ïÅÜ¥¦ªºÃC¦â,¤Sn¦p¦ó³]©w©O?
¦Ñ©Çµª¡G
VB ºô¤Í°Ý¡G
¦pªGn¦b¦P¤@ÓFrame¤¤,¥i¥H¾Ö¦³¨â²Õ¥H¤Wªºoption buttons...
Peter 榭G
¦b¦¹Frame ¤¤¦A¥[¨âÓ Frame ©ñ option buutons
¦Ñ©Ç´¡ªá¡G
Frame.BorderStyle=0 ¡A·|Åý¨Ï¥ÎªÌ§¹¥þ·P¨ü¤£¨ì Frame ªº¦s¦b¡C
word ¼¶¼g©ó¤å³¹
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Label1.Caption = "no ascii code"
Label2.Caption = "no ascii code"
Label3.Caption = KeyCode
If Shift And vbShiftMask Then
shift ©M vbshiftmask¥Îand¹BºâÅÞ¿è¶Ü, ÁÙ¬O¦³¨ä¥L·N¸q¡A¬°¦ó Shift ©M¨ä¥L«öÁä¤@°_«ö©M³æ¿W¥u«ö Shift ³£¯àÅã¥Ü ¦¨¥ß(True)? ³o¨â¥ó¨Æ¦bvb¤º³¡¤£¬O¹ï¤Þ¼Æ Shift¨Ó»¡¤£¦P¶Ü?
shift¼ÆÈ ¨Æ¥ó ¥N¸¹ 1 ³æ¿W«öshift vbshiftmask 3 shift+ctrl ¡@ 5 shift+alt ¡@
!?§Ú¯uªº¤£À´?!
¦Ñ©Çµª¡G
pute ¼¶¼g©ó¤å³¹
§Q¥ÎKeycode¨Ó¨îÁä½L¡A¥Î¥kÃ䪺¼Æ¦rÁä "Del"ªº"." keycode=110¡A¦]¦¹¼g¤F¥H¤Uªºµ{¦¡½X¡A¨Ó§@¨îÅýtext1¥u¯à¿é¤J ¼Æ¦r©Î¤p¼ÆÂI
Text_keydown()
dim a as long, b as string
for a=1 to len(text1.text)
b=mid(text.text,a,1)
if isnumeric(b)=false then
msgbox"±z¿é¤J«D¼Æ"
end if
end sub
¦ý¬O§Ú¿é¤J¤F 12.2 µ¥¦³¤p¼ÆÂIªº¸ê®Æ¤§«á«oÅã¥Ü «D¼Æ¦r¡H
¦Ñ©Çµª¡G
- Keydown
- KeyPress
- Change
- KeyUp
- ¦pªG§A¦b KeyDown ùØÀˬd Text1.Text ¡A¬OÀˬd¥¼ Change «eªº Text
Alex. Chang. ¼¶¼g©ó¤å³¹
¦U¦ì¥ý¶i ¦b³o¶¶¹D½Ð±Ð¤@¤U n¦p¦óª¾¹D Frame¤º¦³¨º´XÓOptionButton©O?(³oùØ«üªº¬O Runtime®É)¡H
¦Ñ©Çµª¡G
±H¥óªÌ: sinrue
¦Ñ©Ç±z¦n:½Ð±Ð±z,½s¿èFORM1ªí³æ¤w¸g±N¥¦³Ì¤j¤Æ¤F(¥þ¿Ã¹õ),¦ý§Ún½s¿èªºªí®æ«o¤ñ¥¦¤j,¤]´N¬O»¡FORM1¯à¤£¯à¦³µe±±²°Êªº¥\¯à³]©w,ÁÙ¦³,§Ún±NFORM1©Ò¹ºªºªí®æ¦C¦L¤U¨Ó,windowstate=2 §Q¥Îform1.printform°õ¦æ,µ²ªG¦L¥X¨Óªºªí®æªø and ¼e³£¤ñì½Z¤p,¸Ó«ç»ò¿ì?ÁÂÁ±z«ü±Ð!
¦Ñ©Çµª¡G
¥Î¤@ӳ̲³æªº¿ìªk¸Ñ¨M¡G
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 4140
ClientLeft = 60
ClientTop = 345
ClientWidth = 5955
LinkTopic = "Form1"
ScaleHeight = 4140
ScaleWidth = 5955
StartUpPosition = 3 '¨t²Î¹w³]È
Begin VB.TextBox Text2
Alignment = 2 '¾a¤¤¹ï»ô
BeginProperty Font
Name = "·s²Ó©úÅé"
Size = 14.25
Charset = 136
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 2760
MultiLine = -1 'True
TabIndex = 6
Top = 3240
Width = 2775
End
Begin VB.TextBox Text1
Height = 375
Left = 240
TabIndex = 5
Text = "Text1"
Top = 3480
Width = 2175
End
Begin VB.ListBox List2
Height = 2040
Left = 2520
Sorted = -1 'True
TabIndex = 3
Top = 840
Width = 1935
End
Begin VB.ListBox List1
Height = 2040
Left = 240
Sorted = -1 'True
TabIndex = 2
Top = 840
Width = 2055
End
Begin VB.Label Label3
Caption = "Label3"
Height = 375
Left = 240
TabIndex = 4
Top = 3120
Width = 2055
End
Begin VB.Label Label2
Caption = "Label2"
Height = 375
Left = 2640
TabIndex = 1
Top = 480
Width = 1695
End
Begin VB.Label Label1
Caption = "Label1"
Height = 375
Left = 240
TabIndex = 0
Top = 480
Width = 1935
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 Form_Load()
Dim CheckFont As New StdFont
Dim I As Long
Label1.Caption = "¤¤¤å¦r«¬"
Label2.Caption = "^¤å¦r«¬"
Label3.Caption = "§A¿ï¥Îªº¿Ã¹õ¦r«¬"
Text1.Text = "·s²Ó©úÅé"
Text2.Text = "¦r«¬®ÄªG¹wÄý ABC"
Text2.FontSize = 14
Me.Show
ChangeVisibleMode
ShowLogo
For I = 0 To Screen.FontCount - 1
CheckFont = Screen.Fonts(I)
If CheckFont.Charset = 136 Then
List1.AddItem CheckFont.Name
Else
List2.AddItem CheckFont.Name
End If
Next
Me.Cls
ChangeVisibleMode
End Sub
Private Sub List1_Click()
Text1.Text = List1.List(List1.ListIndex)
SetTextFont
End Sub
Private Sub List2_Click()
Text1.Text = List2.List(List2.ListIndex)
SetTextFont
End Sub
Private Sub SetTextFont()
Text2.Font = Me.Font
Text2.FontSize = 14
Text2.FontName = Text1.Text
End Sub
Private Sub ChangeVisibleMode()
Dim I As Integer
For I = 0 To Me.Controls.Count - 1
Me.Controls(I).Visible = Not Me.Controls(I).Visible
Next
End Sub
Private Sub ShowLogo()
Dim ShowString As String
Dim Size As Integer
ShowString = "¦r«¬¸ü¤J¤¤¡A½Ðµy«Ý¡C"
Size = Me.FontSize
Me.FontSize = 18
Me.CurrentX = (Me.ScaleWidth - Me.TextWidth(ShowString)) / 2
Me.CurrentY = (Me.ScaleHeight - Me.TextHeight(ShowString)) / 2
Me.Print ShowString
DoEvents
Me.FontSize = Size
End Sub