现在,我的代码看起来像这样:
原文链接:https://www.f2er.com/vb/255134.htmlPrivate Sub ShowReport(ByVal reportName As String) Select Case reportName Case "Security" Me.ShowSecurityReport() Case "Configuration" Me.ShowConfigurationReport() Case "RoleUsers" Me.ShowRoleUsersReport() Case Else pnlMessage.Visible = True litMessage.Text = "The report name """ + reportName + """ is invalid." End Select End Sub
有没有办法创建代码,使用我的方法命名约定来简化事情?这是一些描述我正在寻找的伪代码:
Private Sub ShowReport(ByVal reportName As String) Try Call("Show" + reportName + "Report") Catch ex As Exception 'method not found End Try End Sub