注册 登录
编程论坛 VB6论坛

【求助】format格式化出现了“错误的参数号或无效的属性赋值”,怎么办,哪里出问题了?

YinruoH 发布于 2015-06-11 15:29, 1306 次点击
Dim str$, X%
Private Declare Function SetWindowPos& Lib "user32" (ByVal hwnd As Long, _
  ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal y As Long, _
  ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long)                         '此段为通用声明


Private Sub cls_Click()                                                   '清空文本框
  a = MsgBox("你确定要清空?", vbYesNo, "提示")
  If a = 6 Then Text1.Text = ""
End Sub

Private Sub Form_Load()
  SetWindowPos Me.hwnd, -1, 0, 0, 0, 0, 3                               '将以上两段代码加入程序即可使程序始终保持在最上端
  str = format(Now, "yy-mm-dd hh")
 'Open "C:\Users\Administrator\Desktop\1.txt" For Output As #1     在桌面新建文件
  Open App.Path & "\" & "音若记事本" & str & ".txt" For Output As #1                   '在程序所在文件夹新建
End Sub
                                               

Private Sub Form_Resize()                 '使文本框大小与窗体大小一致
  Text1.Width = Me.Width
  Text1.Height = Me.Height
End Sub

Private Sub Form_Unload(Cancel As Integer) '关闭程序时保存
  Print #1, Text1.Text
  Close #1
End Sub

Private Sub saveas_Click()                   '另存为
  str = format(Now, "yy-mm-dd hh") & "副 本"
  Open App.Path & "\" & "音若记事本" & str & ".txt" For Output As #2
  Print #2, Text1.Text
  Close #2
End Sub
2 回复
#2
lianyicq2015-06-11 15:37
form_load过程运行了,没出问题
#3
YinruoH2015-06-11 17:12
我知道什么原因了,看这里!http://group.
1