2016-11-04 41 views
0

私人小組的button1_Click一個構件(BYVAL發件人爲System.Object的, BYVALË作爲System.EventArgs)把手Button1.Click錯誤BC30456 t '形式' 不是 '視窗'

With OpenFileDialog1 
     .FileName = String.Empty 
     .InitialDirectory = "C:\" 
     .Title = "Open Excel File" 
     .Filter = "Excel 97-2003|*.xls|Excel 2007|*.xlsx" 
    End With 
    Dim result As DialogResult = OpenFileDialog1.ShowDialog() 
    If result = Windows.Form.DialogResult.OK Then 
     Try 
      TextBox1.Text = OpenFileDialog1.FileName 
      GetExcelSheetNames(TextBox1.Text) 
     Catch ex As Exception 
      MsgBox("Error : " & ex.Message) 
     End Try 
    End If 

End Sub 
+1

可能的SQL注入。使用參數來防止這種情況!處理你的對象也很重要。 – Codexer

+0

呃?你的問題是什麼?你有什麼問題? – romulus001

+0

爲我傳遞文本框表單登錄標記形式1提示和技巧 –

回答

3
Public Class Form1 
    Private loginLabel As String 

    Public Sub New(ByVal loginParameter As String) 
     InitializeComponent() 

     Me.loginLabel = loginParameter 

    End Sub 
End Class 

並在您的登錄表單中:

dim frm as new Form1(label.Text) 
相關問題