求教 VB.NET+access 操作
定义了一个函数Sub ShowEmpInfo()
Me.hr_nanme.Text = CurEmp.Emp_Name
Me.hr_sex.Text = CurEmp.Sex
Me.hr_num.Text = CurEmp.Emp_Num
Me.hr_address.Text = CurEmp.Emp_Add
Me.hr_intime.Text = CurEmp.Emp_intime
Me.hr_outtime.Text = CurEmp.Emp_outtime
Me.hr_memo.Text = CurEmp.Emp_Memo
End sub
窗体有个listbox,需要加载 员工表 中的 员工姓名
Private Sub Frm_hr_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
LBUserName.Items.Clear()
Dim SQLString As String = "SELECT * FROM 员工表"
Dim MSG As String = ""
'执行SQL查询语句
Dim DTable As DataTable = DBoperation.DBoperate(SQLString, MSG)
Dim UserRow As DataRow
For Each UserRow In DTable.Rows
LBUserName.Items.Add(UserRow("员工姓名"))
LBUserName.ValueMember = "员工ID"
LBUserName.SelectedValue = "员工ID"
'LBUserName.DisplayMember = "员工姓名"
Next
End Sub
选择员工姓名时,窗体其他标签的内容读取Access表的信息显示
Private Sub LBUserName_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LBUserName.SelectedIndexChanged
If LBUserName.ValueMember = "" Then
CurEmp.Init()
End If
CurEmp.GetInfo(CInt(LBUserName.SelectedValue))
ShowEmpInfo()
End Sub
但是怎么也实现不了,就是这个selectedValue传递有问题