标题:Vb用户定义类型未定义,求救?
只看楼主
pgykcy
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2008-7-11
 问题点数:0 回复次数:7 
Vb用户定义类型未定义,求救?
Private Sub tlbToolBar_ButtonClick(ByVal Button As ComctlLib.Button)

  On Error GoTo tlbToolBar_ButtonClickErr
  
  Select Case Button.Key
    Case "New"
      mnuDBNew_Click
    Case "Open"
      mnuDBOpen_Click
      Me.mnuOptPaint.Enabled = True
    Case "Close"
      mnuDBClose_Click
      Me.mnuOptPaint.Enabled = False '使绘制对比图按钮无效
    Case "Edit"
      mnuEdtEditer_Click
    Case "Delete"
      mnuEdtDelete_Click
    Case "Number"
      mnuEdtNumber_Click
  End Select
  
  Exit Sub
  
tlbToolBar_ButtonClickErr:
  ShowError

End Sub
搜索更多相关主题的帖子: Case 定义 Click 类型 
2008-07-11 10:38
vbc
Rank: 3Rank: 3
等 级:论坛游侠
帖 子:352
专家分:147
注 册:2006-12-30
得分:0 
有完整一点的程序吗???
有完整一点的程序吗,很难帮你看,
Private Sub tlbToolBar_ButtonClick(ByVal Button As ComctlLib.Button)看看改成as control行不行??

清远鹏程万里人才网:[url=http://www.]http://www.[/url]zq.,qy.
2008-07-11 10:47
pgykcy
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2008-7-11
得分:0 
回复 2# vbc 的帖子
Option Explicit
Option Compare Binary
'¹¤¾ßÌáʾ
Const TOOLTIP1 = "н¨Êý¾Ý¿â"
Const TOOLTIP2 = "´ò¿ªÊý¾Ý¿â"
Const TOOLTIP3 = "¹Ø±ÕÊý¾Ý¿â"
Const TOOLTIP4 = "´«µÝÀàÐͼǼ¼¯"
Const TOOLTIP5 = "ÔÚд°ÌåÉÏʹÓà Data ¿Ø¼þ"
Const TOOLTIP6 = "ÔÚд°ÌåÉϲ»Ê¹Óà Data ¿Ø¼þ"
Const TOOLTIP7 = "ÔÚд°ÌåÉÏʹÓà DBGrid ¿Ø¼þ"
Const TOOLTIP8 = "¿ªÊ¼ÊÂÎñ"
Const TOOLTIP9 = "»Ø¹öµ±Ç°ÊÂÎñ"
Const TOOLTIP10 = "Ìá½»µ±Ç°ÊÂÎñ" '
'ÔÓÏî×Ö·û´®
Const MSG3 = "°´»Ø³µ¼ü¹Ø±Õ¡°¹ØÓÚ¡±¶Ô»°¿ò"   'Ô­ÎÄÓÐÎó
Const MSG4 = "ÊäÈëÐÂÊý¾Ý¿â²ÎÊý"
Const MSG5 = "ÊäÈë ODBCINST.INI ÎļþÖеÄÇý¶¯³ÌÐòÃû³Æ£º"
Const MSG6 = "Çý¶¯³ÌÐòÃû³Æ"
Const MSG7 = "±ØÐëÊ×Ïȹرգ¡"
Const MSG8 = "×¢Ò⣺ÍƼöʹÓø½¼Ó±í"
Const MSG9 = "Microsoft Access MDB (*.mdb)|*.mdb|ËùÓÐÎļþ (*.*)|*.*"
Const MSG10 = "´ò¿ªÒªÐÞ¸´µÄ Microsoft Access Êý¾Ý¿â"
Const MSG11 = "ÕýÔÚÐÞ¸´"
Const MSG12 = "´ò¿ªÐÞ¸´µÄÊý¾Ý¿âÂð£¿"
Const MSG13 = "ϵͳÊý¾Ý¿â|SYSTEM.MD?"
Const MSG14 = "Ñ¡Ôñ SYSTEM.MD? £¨Microsoft Access °²È«Îļþ£©"
Const MSG15 = "Óû§£º"
Const MSG16 = "ÒòΪ´íÎ󣬱ØÐë¹Ø±Õµ±Ç°Êý¾Ý¿â£¡"
Const MSG17 = "δÕÒµ½Óû§£¬ÊÔһϡ°ÊµÓóÌÐò/System MD?¡±£¡"
Const MSG18 = "µÇ¼³¬Ê±£¨Ã룩£º"
Const MSG19 = "ûÓдò¿ªµÄÊý¾Ý¿â"
Const MSG20 = "²éѯ³¬Ê±£¨Ã룩£º"
Const MSG21 = "ɾ³ý±íÂð£¿"
Const MSG22 = "ɾ³ý²éѯ¶¨ÒåÂð£¿"
Const MSG23 = "ɾ³ý×Ö¶ÎÂð£¿"
Const MSG24 = "ɾ³ýË÷ÒýÂð£¿"
Const MSG25 = "ɾ³ý±íÖÐËùÓмǼÂð£¿"
Const MSG26 = "ɾ³ýµÄÐУº"
Const MSG27 = "δÕÒµ½ SYSTEM.MD?£¬ÔÚ VB ÉèÖÃÖµÖмÓÈëÒ»¸öÂð£¿"
Const MSG28 = "Õâ¸öÇý¶¯³ÌÐò²»Ö§³ÖÊÂÎñ£¡"
Const MSG29 = "ËùÓиı佫±»¶ªÊ§£¬»Ø¹öÂð£¿"
Const MSG30 = "ÊôÐÔÊÇÖ»¶ÁµÄ£¡"
Const MSG31 = "¸Ãº¯ÊýÐèÒªÒ»¸ö»î¶¯µÄ¹¤³Ì£¡"
Const MSG37 = "ɾ³ý¼Ç¼Âð£¿"
'>>>>>>>>>>>>>>>>>>>>>>>>

Dim mHwnd As Long
Private Sub mnuUSystemDB_Click()
  
  On Error Resume Next
  
  Dim sTmp As String
  Dim X As Integer
  
  With dlgCMD1
    .Filter = MSG13
    .DialogTitle = MSG14
    .FilterIndex = 1
    .FileName = "SYSTEM.MDW"
    .CancelError = True
    .Flags = FileOpenConstants.cdlOFNHideReadOnly + FileOpenConstants.cdlOFNFileMustExist
  End With
  On Error Resume Next
  dlgCMD1.ShowOpen
  If Err = 32755 Then         'Óû§È¡ÏûÁË
    Exit Sub
  Else
    sTmp = dlgCMD1.FileName  '±ØÐëÊÇÒ»¸öºÃµÄÎļþÃû
    SaveSetting APP_CATEGORY & "\Analysis", "Engines", "SystemDB", sTmp
    SaveSetting APP_CATEGORY, App.Title, "LoadSystemDB", "Yes"
  End If

End Sub


Private Sub MDIForm_Load()

  Dim X As Integer
  Screen.MousePointer = vbHourglass
  '¹¤¾ßÌáʾ
  tlbToolBar.Buttons(1).ToolTipText = TOOLTIP1
  tlbToolBar.Buttons(2).ToolTipText = TOOLTIP2
  tlbToolBar.Buttons(3).ToolTipText = TOOLTIP3
  mnuOptReadOnly.Checked = True
  gnReadOnly = True
  gnSelectRun = False

  mnuDBNew.Enabled = False
  mnuDBClose.Visible = False
  mnuDBBar0.Visible = False
  mnuEdit.Visible = False
  mnuOperate.Visible = False

  
  'È¡µÃ´°Ìå×ù±ê
  X = Val(GetINIString("WindowState", "2"))
  If X <> 1 Then
    frmMDI.WindowState = X
  Else
    frmMDI.WindowState = 0
  End If
  If frmMDI.WindowState = 0 Then
    frmMDI.Left = Val(GetINIString("WindowLeft", "0"))
    frmMDI.Top = Val(GetINIString("WindowTop", "0"))
    frmMDI.Width = Val(GetINIString("WindowWidth", "9135"))
    frmMDI.Height = Val(GetINIString("WindowHeight", "6900"))
  End If
  
  '&iquest;&acute;&Ecirc;&Ccedil;·&ntilde;&Oacute;&Atilde;&raquo;§&Ocirc;&Uacute;&Ograve;&Ocirc;&Ccedil;°&raquo;&Oslash;&acute;&eth;&iexcl;°&Igrave;í&frac14;&Oacute; system.mda&iexcl;±&Ecirc;±&Euml;&micro;&iexcl;°&sup2;&raquo;&iexcl;±
  If Len(GetINIString("LoadSystemDB", vbNullString)) = 0 Then
    '&micro;&Uacute;&Ograve;&raquo;&acute;&Icirc;&pound;&not;&Euml;ù&Ograve;&Ocirc;&Igrave;á&Ecirc;&frac34;&Egrave;&ccedil;&sup1;&ucirc;&Atilde;&raquo;&Oacute;&ETH;&frac34;&Iacute;&Igrave;í&frac14;&Oacute;&Euml;ü
    If MsgBox("&Igrave;í&frac14;&Oacute; SYSTEM.MD? (Microsoft Access °&sup2;&Egrave;&laquo;&Icirc;&Auml;&frac14;&thorn;) &micro;&frac12; INI &Icirc;&Auml;&frac14;&thorn;&Acirc;&eth;&pound;&iquest;", vbYesNo + vbQuestion) = vbYes Then
      mnuUSystemDB_Click
    Else
      '&acute;&aelig;&acute;&cent;&ETH;&Aring;&Iuml;&cent;&pound;&not;&frac34;&Iacute;&sup2;&raquo;&Oacute;&Atilde;&Ocirc;&Ugrave;&Icirc;&Ecirc;&Aacute;&Euml;
      SaveSetting APP_CATEGORY, App.Title, "LoadSystemDB", "No"
    End If
  End If
  
  On Error GoTo MDILErr
  
  '&Eacute;è&Ouml;&Atilde; DBEngine
  DBEngine.IniPath = "HKEY_CURRENT_USER\Software\VB and VBA Program Settings\" & APP_CATEGORY & "\" & App.Title
  DBEngine.DefaultUser = "admin"
  DBEngine.DefaultPassword = vbNullString

  '&micro;&Ccedil;&Acirc;&frac14;&micro;&frac12; Jet
  On Error Resume Next
  Set gwsMainWS = DBEngine.CreateWorkspace("MainWS", "admin", vbNullString)
  On Error GoTo MDILErr
  
  '&Igrave;í&frac14;&Oacute;&sup1;¤×÷&iquest;&Otilde;&frac14;&auml;&micro;&frac12;&frac14;&macr;&ordm;&Iuml;&Ouml;&ETH;&pound;&not;&Ocirc;&ouml;&frac14;&Oacute;&AElig;&auml;&Ecirc;&yacute;&Aacute;&iquest;
  Workspaces.Append gwsMainWS
  Me.Show
  LoadINISettings
  Screen.MousePointer = vbDefault
  Exit Sub

MDILErr:
  ShowError
   
End Sub

Private Sub MDIForm_QueryUnload(Cancel As Integer, UnloadMode As Integer)
  
  On Error Resume Next
  ShutDownAnalysis
  
  If mHwnd <> 0 Then
    '&micro;± VisData &acute;&Oacute; VB &micro;&Auml;&iexcl;°&Iacute;&acirc;&frac12;&Oacute;&sup3;&Igrave;&ETH;ò&iexcl;±&sup2;&Euml;&micro;&yen;&Ouml;&ETH;&frac14;&Oacute;&Ocirc;&Oslash;&Ecirc;±&ETH;è&Ograve;&ordf;
    mHwnd = SetWindowLong(Me.hwnd, -8, GetDesktopWindow())
  End If

End Sub

Private Sub mnuDBClose_Click()
  Me.mnuOptPaint.Enabled = False '&Ecirc;&sup1;&raquo;&aelig;&Ouml;&AElig;&para;&Ocirc;±&Egrave;&Iacute;&frac14;°&acute;&Aring;&yen;&Icirc;&THORN;&ETH;§
  mnuOptRelative.Enabled = False
  CloseCurrentDB
End Sub

Private Sub mnuDBExit_Click()

  Unload Me
  
End Sub


Private Sub mnuDBMRU_Click(Index As Integer)
 
  On Error GoTo MRUErr

  gsDBName = Mid(mnuDBMRU(Index).Caption, 4, Len(mnuDBMRU(Index).Caption))
  gsDataType = mnuDBMRU(Index).Tag
  OpenLocalDB 2
  Me.mnuOptPaint.Enabled = True
  Exit Sub
MRUErr:
  ShowError
End Sub

Private Sub mnuDBNew_Click()
  NewMDB dbVersion30
End Sub

Private Sub mnuDBOpen_Click()
  '&acute;ò&iquest;&ordf;&Ecirc;&yacute;&frac34;&Yacute;&Icirc;&Auml;&frac14;&thorn;
  gsDataType = gsMSACCESS
  OpenLocalDB 1
  Me.mnuOptPaint.Enabled = True
End Sub
Private Sub mnuDfilter_Click()

  Dim frm As New frmFilter
  frm.Show
  
End Sub

Private Sub mnuEdtDelete_Click()

  On Error GoTo RFErr

  If Not grstRecordset.EOF Then
    If MsgBox(MSG37, vbYesNo + vbQuestion) = vbYes Then
      grstRecordset.Delete
    End If
  End If
  Exit Sub

RFErr:
  ShowError
  
End Sub

Private Sub mnuEdtNumber_Click()

  On Error GoTo NMbErr
  
  Dim i As Integer
  
  grstRecordset.MoveFirst
  With grstRecordset.Fields(0)
    For i = 1 To grstRecordset.RecordCount
      grstRecordset.Edit
      .Value = i
      grstRecordset.Update
      grstRecordset.MoveNext
    Next i
  End With

  Exit Sub

NMbErr:
  ShowError
End Sub


Private Sub mnuEdtEditer_Click()

  On Error GoTo LoadErr

  Dim str As String
  Dim dbTemp As Database
  
  str = gsDBName
  CloseCurrentDB
  
  Set dbTemp = gwsMainWS.OpenDatabase(str, False, gnReadOnly, vbNullString)
  Set gdbCurrentDB = dbTemp
  gsDBName = str
  frmTblStruct.Show vbModal
  
  Exit Sub
  
LoadErr:
  ShowError
End Sub
Private Sub mnuHelpContents_Click()
   

    Dim nRet As Integer

    '&Egrave;&ccedil;&sup1;&ucirc;&Otilde;&acirc;&cedil;&ouml;&sup1;¤&sup3;&Igrave;&Atilde;&raquo;&Oacute;&ETH;°&iuml;&Ouml;ú&Icirc;&Auml;&frac14;&thorn;&pound;&not;&Iuml;&Ocirc;&Ecirc;&frac34;&Iuml;&ucirc;&Iuml;&cent;&cedil;&oslash;&Oacute;&Atilde;&raquo;§
    '&iquest;&Eacute;&Ograve;&Ocirc;&Ocirc;&Uacute;&iexcl;°&sup1;¤&sup3;&Igrave;&Ecirc;&ocirc;&ETH;&Ocirc;&iexcl;±&para;&Ocirc;&raquo;°&iquest;ò&Ouml;&ETH;&Icirc;&ordf;&Oacute;&brvbar;&Oacute;&Atilde;&sup3;&Igrave;&ETH;ò&Eacute;è&Ouml;&Atilde;°&iuml;&Ouml;ú&Icirc;&Auml;&frac14;&thorn;
    App.HelpFile = App.Path + "\" + "analysis.hlp"
    If Len(App.HelpFile) = 0 Then
        MsgBox "&Icirc;&THORN;·¨&Iuml;&Ocirc;&Ecirc;&frac34;°&iuml;&Ouml;ú&Auml;&iquest;&Acirc;&frac14;&pound;&not;&cedil;&Atilde;&sup1;¤&sup3;&Igrave;&Atilde;&raquo;&Oacute;&ETH;&Iuml;à&sup1;&Oslash;&Aacute;&ordf;&micro;&Auml;°&iuml;&Ouml;ú&iexcl;&pound;", vbInformation, Me.Caption
    Else
        On Error Resume Next
        nRet = OSWinHelp(Me.hwnd, App.HelpFile, 3, 0)
        If Err Then
            MsgBox Err.Description
        End If
    End If
End Sub


Private Sub mnuHelpSearch_Click()
    Dim nRet As Integer
    App.HelpFile = App.Path + "\" + "analysis.hlp"
    '&Egrave;&ccedil;&sup1;&ucirc;&Otilde;&acirc;&cedil;&ouml;&sup1;¤&sup3;&Igrave;&Atilde;&raquo;&Oacute;&ETH;°&iuml;&Ouml;ú&Icirc;&Auml;&frac14;&thorn;&pound;&not;&Iuml;&Ocirc;&Ecirc;&frac34;&Iuml;&ucirc;&Iuml;&cent;&cedil;&oslash;&Oacute;&Atilde;&raquo;§&iquest;&Eacute;&Ograve;&Ocirc;&Ocirc;&Uacute;&iexcl;°&sup1;¤&sup3;&Igrave;&Ecirc;&ocirc;&ETH;&Ocirc;&iexcl;±&para;&Ocirc;&raquo;°&iquest;ò&Ouml;&ETH;&Icirc;&ordf;&Oacute;&brvbar;&Oacute;&Atilde;&sup3;&Igrave;&ETH;ò&Eacute;è&Ouml;&Atilde;°&iuml;&Ouml;ú&Icirc;&Auml;&frac14;&thorn;
    If Len(App.HelpFile) = 0 Then
        MsgBox "&Icirc;&THORN;·¨&Iuml;&Ocirc;&Ecirc;&frac34;°&iuml;&Ouml;ú&Auml;&iquest;&Acirc;&frac14;&pound;&not;&cedil;&Atilde;&sup1;¤&sup3;&Igrave;&Atilde;&raquo;&Oacute;&ETH;&Iuml;à&sup1;&Oslash;&Aacute;&ordf;&micro;&Auml;°&iuml;&Ouml;ú&iexcl;&pound;", vbInformation, Me.Caption
    Else
        On Error Resume Next
        nRet = OSWinHelp(Me.hwnd, App.HelpFile, 261, 0)
        If Err Then
            MsgBox Err.Description
        End If
    End If
End Sub

Private Sub mnuHlpAbout_Click()
    frmAbout.Show 1
End Sub

Private Sub mnuOperStart_Click()
  Dim frm As New frmOperation
  If gnSelectRun Then frmSetRange.Show vbModal
  frm.Show
End Sub

Private Sub mnuOptDeterminer_Click()

  frmDeterminer.Show vbModal
  
End Sub

Private Sub mnuOptPaint_Click()
     optPaint.Show 1
End Sub

Private Sub mnuOptReadOnly_Click()

  If mnuOptReadOnly.Checked = True Then
    mnuOptReadOnly.Checked = False
    gnReadOnly = False
    mnuDBNew.Enabled = True
    tlbToolBar.Buttons("New").Enabled = True
    mnuEdit.Enabled = True
  Else
    mnuOptReadOnly.Checked = True
    gnReadOnly = True
    mnuDBNew.Enabled = False
    tlbToolBar.Buttons("New").Enabled = False
    mnuEdit.Enabled = False
  End If
  
End Sub

Private Sub mnuOptRelative_Click()
    ksqt.Show
End Sub

Private Sub mnuOptSelectRun_Click()
  If mnuOptSelectRun.Checked = True Then
    mnuOptSelectRun.Checked = False
    gnSelectRun = False
  Else
    mnuOptSelectRun.Checked = True
    gnSelectRun = True
  End If
  
End Sub

Private Sub mnuRC_Click()
  mnuOperStart.Enabled = True
  If relativeAlyasis = True Then
  mnuOptRelative.Enabled = True
  Else
  mnuOptRelative.Enabled = False
  End If
  frmRateCalcu.Show
End Sub

Private Sub Timer1_Timer()
  frmMDI.stsStatusBar.Panels(3).Text = Format$(Time, "  hh:mm:ss")
  frmMDI.stsStatusBar.Panels(1).Text = "°&aelig;&Egrave;¨&Euml;ù&Oacute;&ETH;(C) 1999-2000"
End Sub

Private Sub tlbToolBar_ButtonClick(ByVal Button As Control)

  On Error GoTo tlbToolBar_ButtonClickErr
  
  Select Case Button.Key
    Case "New"
      mnuDBNew_Click
    Case "Open"
      mnuDBOpen_Click
      Me.mnuOptPaint.Enabled = True
    Case "Close"
      mnuDBClose_Click
      Me.mnuOptPaint.Enabled = False '&Ecirc;&sup1;&raquo;&aelig;&Ouml;&AElig;&para;&Ocirc;±&Egrave;&Iacute;&frac14;°&acute;&Aring;&yen;&Icirc;&THORN;&ETH;§
    Case "Edit"
      mnuEdtEditer_Click
    Case "Delete"
      mnuEdtDelete_Click
    Case "Number"
      mnuEdtNumber_Click
  End Select
  Exit Sub
  
tlbToolBar_ButtonClickErr:
  ShowError

End Sub
2008-07-11 11:14
pgykcy
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2008-7-11
得分:0 
回复 3# pgykcy 的帖子
改成它:Private Sub tlbToolBar_ButtonClick(ByVal Button As Control)
也不行啊!
2008-07-11 11:16
vbc
Rank: 3Rank: 3
等 级:论坛游侠
帖 子:352
专家分:147
注 册:2006-12-30
得分:0 
本想帮你调试一下,但我真的没法帮你调试,这样子只有程序代码的话,

清远鹏程万里人才网:[url=http://www.]http://www.[/url]zq.,qy.
2008-07-11 12:36
vbc
Rank: 3Rank: 3
等 级:论坛游侠
帖 子:352
专家分:147
注 册:2006-12-30
得分:0 
想问一下怎么你的代码这么多看不懂的字符的???
不是加密过的,那么先进吧..

清远鹏程万里人才网:[url=http://www.]http://www.[/url]zq.,qy.
2008-07-11 12:44
cbean
Rank: 1
等 级:新手上路
帖 子:44
专家分:0
注 册:2008-7-11
得分:0 
你把程序打包,再放上来让我们调试吧
2008-07-15 22:57
jxyga111
Rank: 8Rank: 8
来 自:中華人民共和國
等 级:贵宾
威 望:33
帖 子:6015
专家分:895
注 册:2008-3-21
得分:0 
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)

烈焰照耀世界,斌凍凍千萬裏
2008-07-16 08:14



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-223473-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.427500 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved