启动窗体问题,加了实例之后不能用作启动窗体
Public Class Roll_Info_Browse_Admis
Private _StudentNo As String
Public Sub New(ByVal StudentNo As String)
_StudentNo = StudentNo
InitializeComponent()
End Sub
Function zhaoshengxinxi() As DataTable
Dim SQLString As String
SQLString = "SELECT * FROM 招生人员信息表"
Dim zhaoshengTable As DataTable
zhaoshengTable = DBOperation.DBOperate(SQLString)
Return zhaoshengTable
End Function
Private Sub FrmLZhaosheng_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.ComboBox1.DataSource = zhaoshengxinxi()
Me.ComboBox1.DisplayMember = "姓名"
Me.ComboBox1.SelectedIndex = 0
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim SQLString As String
SQLString = "SELECT * FROM 学生信息表 WHERE 招生人员='" & Me.ComboBox1.Text & "'"
Dim banjiTable As DataTable
banjiTable = DBOperation.DBOperate(SQLString)
Me.DataGridView1.DataSource = banjiTable
End Sub
Private Sub DataGridView1_CellContentDoubleClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentDoubleClick
Dim xinxi As String = Me.DataGridView1.Rows(e.RowIndex).Cells(0).Value
Dim FrmObj As New Roll_Info_Up_Save(xinxi)
'获取设置窗体的状态,下面选择是以最小状态显示
Me.WindowState = FormWindowState.Minimized
FrmObj.ShowDialog(Me.Parent) '显示添加用户的窗体
End Sub
End Class
[解决办法]
Private _StudentNo As String
Public Sub New(ByVal StudentNo As String)
' 此调用是 Windows 窗体设计器所必需的。
InitializeComponent()
' 在 InitializeComponent() 调用之后添加任何初始化。
_StudentNo = StudentNo
End Sub