我有三种形式
我使用了menustrip来创建菜单。菜单条包含:
表单用户(调用formuser)
menustrip中的代码是:
dim Fuser作为新的formuser Fuser.MDIParent =我 fuser.show()
报告(致电表格报告)
menustrip中的代码是:
dim Rp作为新报告 Rp.MDIParent =我 Rp.show()
我的问题是
如何从“MDI表单”显示用户表单,但关闭或隐藏报表表单,因为当我使用上面的代码时,MDI表单有很多与我调用的格式相同 - 再次< / p>
答案 0 :(得分:0)
下面是我的程序代码,当我运行它所有控制按钮不工作时,我将表名更改为注释everthing工作正常,但如果删除注释程序不工作,数据表显示在组合框
*
公共类temp_vch Dim VCH_TRANS As DataTable
Dim vtype As DataTable
Dim credit_cust As DataTable
Dim debit_cust As DataTable
Dim bnd1 As BindingSource
Dim da As OleDb.OleDbDataAdapter
Dim ds As DataSet
Dim cmd As OleDb.OleDbCommand
Dim debit_code_id As Integer = 0
Dim credit_code_id As Integer = 0
Dim vch_type_id As Integer = 0
Private Sub temp_vch_Load(sender As Object, e As EventArgs) Handles MyBase.Load
vtype = New DataTable("VCH_TYPE")
credit_cust = New DataTable("CUST")
debit_cust = New DataTable("CUST")
VCH_TRANS = New DataTable("VCH_TRANS")
proc_list.create_database_table("TRANS_TYPE", vtype)
proc_list.create_database_table("CUST", credit_cust)
proc_list.create_database_table("CUST", debit_cust)
'proc_list.create_database_table("VCH_TRANS", VCH_TRANS)
proc_list.fill_table(credit_cust, "CUST_NAME")
proc_list.fill_table(debit_cust, "CUST_NAME")
CREDIT_CMB.DataSource = credit_cust
CREDIT_CMB.DisplayMember = "CUST_NAME"
CREDIT_CMB.ValueMember = "CUST_ID"
CREDIT_CMB.SelectedItem = "trans.CR_CUST_CODE"
DEBIT_CMB.DataSource = debit_cust
DEBIT_CMB.DisplayMember = "CUST_NAME"
DEBIT_CMB.ValueMember = "CUST_ID"
DEBIT_CMB.SelectedItem = "trans.DR_CUST_CODE"
CMB_VTYPE.DataSource = vtype
CMB_VTYPE.DisplayMember = "TT_TYPE"
CMB_VTYPE.ValueMember = "TT_TYPE_ID"
CMB_VTYPE.SelectedItem = "trans.vch_type"
' bnd1 = New BindingSource
'ds = New DataSet
'da = New OleDb.OleDbDataAdapter
'con.Open()
'cmd = New OleDb.OleDbCommand("Select * from trans order by tdate", con)
'cmd.CommandType = CommandType.Text
'da.SelectCommand = cmd
'con.Close()
'ds.Clear()
'da.Fill(ds, "TRANS")
'bnd1.DataSource = ds
'bnd1.DataMember = "TRANS"
'VCH_TYPEID.DataBindings.Add(New Binding("TEXT", bnd1, "VCH_TYPE", True))
'CR_ID.DataBindings.Add(New Binding("TEXT", bnd1, "CR_CUST_CODE", True))
'DR_ID.DataBindings.Add(New Binding("TEXT", bnd1, "DR_CUST_CODE", True))
'AMOUNT.DataBindings.Add(New Binding("TEXT", bnd1, "AMOUNT", True))
'NARAT.DataBindings.Add(New Binding("TEXT", bnd1, "NARAT", True))
'VCH_TYPEID.DataBindings.Add(New Binding("TEXT", bnd1, "VCH_TYPE", True))
'mask_date.DataBindings.Add(New Binding("TEXT", bnd1, "TDATE", True))
'CMB_VTYPE.DataBindings.Add(New Binding("selectedvalue", bnd1, "VCH_TYPE", True))
'CREDIT_CMB.DataBindings.Add(New Binding("selectedvalue", bnd1, "CR_CUST_CODE", True))
'DEBIT_CMB.DataBindings.Add(New Binding("selectedvalue", bnd1, "DR_CUST_CODE", True))
proc_list.fill_text_autosource(CREDIT_AC, "CUST", "CUST_NAME")
proc_list.fill_text_autosource(DEBIT_AC, "CUST", "CUST_NAME")
AddHandler nevi1.add.Click, AddressOf addclick
AddHandler nevi1.edit.Click, AddressOf addclick
AddHandler nevi1.Reject.Click, AddressOf addclick
AddHandler nevi1.delete.Click, AddressOf addclick
AddHandler nevi1.bexit.Click, AddressOf addclick
AddHandler nevi1.save.Click, AddressOf addclick
AddHandler nevi1.bnext.Click, AddressOf addclick
AddHandler nevi1.prev.Click, AddressOf addclick
AddHandler nevi1.first.Click, AddressOf addclick
AddHandler nevi1.last.Click, AddressOf addclick
AddHandler nevi1.print.Click, AddressOf addclick
AddHandler nevi1.excel.Click, AddressOf addclick
proc_list.button_set("change_end", Me, nevi1)
bnd1.MoveFirst()
End Sub
Private Sub addclick(ByVal sender As Object, ByVal args As EventArgs) Handles nevi1.Click
Me.nevigate_click()
End Sub
Sub nevigate_click()
Select Case proc_list.nevi_btn_click
Case "EXIT"
Me.Close()
Case "NEXT"
bnd1.MoveNext()
Case "PREV"
bnd1.MovePrevious()
Case "LAST"
bnd1.MoveLast()
Case "FIRST"
bnd1.MoveFirst()
Case "EXCEL"
MsgBox("Not Working")
Case "PRINT"
MsgBox("Not Working")
Case "ADD"
proc_list.button_set("change_start", Me, nevi1)
CREDIT_CMB.Visible = False
DEBIT_CMB.Visible = False
new_edit = "ADD"
bnd1.EndEdit()
bnd1.AddNew()
CREDIT_AC.Text = ""
DEBIT_AC.Text = ""
CMB_VTYPE.Focus()
Me.mask_date.Text = Now.Date
Case "SAVE"
vch_type_id = DirectCast(CMB_VTYPE.SelectedItem, DataRowView).Item("tt_type_id")
Dim inst_text As String = ""
Dim num_amount As Integer = Val(AMOUNT.Text)
Dim book_type As String = "CB"
Dim ts_date As Date = #2/13/2014#
ts_date = DateValue(mask_date.Text)
Select Case new_edit
Case "ADD"
inst_text = "Insert into trans (CR_CUST_CODE, NARAT, AMOUNT, DR_CUST_CODE, REG_ID, VCH_TYPE, TDATE)"
inst_text = inst_text + " VALUES (credit_code_id, narat.text, num_amount, debit_code_id, BOOK_TYPE, VCH_TYPE_ID, TS_DATE)"
Dim ins_cmd As OleDb.OleDbCommand
ins_cmd = New OleDb.OleDbCommand(inst_text, con)
ins_cmd.Parameters.AddWithValue("@CR_CUST_CODE", credit_code_id)
ins_cmd.Parameters.AddWithValue("@NARAT", NARAT.Text)
ins_cmd.Parameters.AddWithValue("@AMOUNT", num_amount)
ins_cmd.Parameters.AddWithValue("@DR_CUST_CODE", debit_code_id)
ins_cmd.Parameters.AddWithValue("@REG_ID", book_type)
ins_cmd.Parameters.AddWithValue("@VCH_TYPE", vch_type_id)
ins_cmd.Parameters.AddWithValue("@TDATE", ts_date)
ins_cmd.Connection = con
con.Open()
ins_cmd.ExecuteNonQuery()
con.Close()
MsgBox("TRANS SAVE ")
proc_list.button_set("change_end", Me, nevi1)
CREDIT_CMB.Visible = True
DEBIT_CMB.Visible = True
End Select
End Select
End Sub
Private Sub CREDIT_AC_Validated(sender As Object, e As EventArgs) Handles CREDIT_AC.Validated
proc_list.FIND_CUST_DETAIL(CREDIT_AC.Text, "CUST_NAME")
CR_CUST_NAME.Text = C_DET.CUST_NAME
CR_OPEN_AMT.Text = C_DET.OPEN_BALAN
CR_OPSIDE.Text = IIf(C_DET.OPEN_SIDE = 1, "CR", "DR")
credit_code_id = C_DET.CUST_ID
End Sub
Private Sub DEBIT_AC_Validated(sender As Object, e As EventArgs) Handles DEBIT_AC.Validated
proc_list.FIND_CUST_DETAIL(DEBIT_AC.Text, "CUST_NAME")
DEBT_AC.Text = C_DET.CUST_NAME
DEBT_OPEN.Text = C_DET.OPEN_BALAN
DEBT_OPSIDE.Text = IIf(C_DET.OPEN_SIDE = 1, "CR", "DR")
debit_code_id = C_DET.CUST_ID
End Sub
Private Sub CMB_VTYPE_SelectedIndexChanged(sender As Object, e As EventArgs) Handles CMB_VTYPE.SelectedIndexChanged
'If proc_list.nevi_btn_click = "LOAD" Then
'Else
' proc_list.COMBO_VAL_CHANGE(NARAT, VCH_TYPEID, CMB_VTYPE, "VCH_TYPE")
'End If
End Sub
Private Sub CREDIT_CMB_SelectedIndexChanged(sender As Object, e As EventArgs) Handles CREDIT_CMB.SelectedIndexChanged
'If proc_list.nevi_btn_click = "LOAD" Then
'Else
' proc_list.COMBO_VAL_CHANGE(NARAT, CR_ID, CREDIT_CMB, "CR_CUST_CODE")
'End If
End Sub
Private Sub DEBIT_CMB_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DEBIT_CMB.SelectedIndexChanged
'If proc_list.nevi_btn_click = "LOAD" Then
'Else
' proc_list.COMBO_VAL_CHANGE(NARAT, DR_ID, DEBIT_CMB, "DR_CUST_CODE")
'End If
End Sub
结束班