-----Original Message-----
Hi Albert,
Have you got any offending code to show us?
Regards,
Fergus
.
hi Fergus,
I set the datasource for the combo(cmbTrmCde) to a
datatable (dt) at the form loading stage. when I check
for the selectvalue at the selectindexchange event, it
sometime throws error that it can't read b'cos it
is "System.Data.DataRowView" type. So I have to write the
additional codes to work around it by handling the
exception... I may have missed something that caused the
selectedvalue became "datarowview" type, any suggestion??
Rgds,
Albert
-------------- code --------------
Public Class FrmPymntrm
Dim dvTrm As New PymntLst
Dim dv As New DataView
Dim dt As New DataTable
Dim idx As Integer
#Region " Windows Form Designer generated code "
.....
Friend WithEvents cmbTrmCde As
system.Windows.Forms.ComboBox
......
#End Region
Private Sub FrmPymntrm_Load(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
MyBase.Load
dv = dvTrm.IniPymnt
Dim dr As DataRow
dt = dv.Table()
cmbTrmCde.DataSource = dt
cmbTrmCde.DisplayMember = dvTrm.PymntDsp
cmbTrmCde.ValueMember = dvTrm.PymntVlM
End Sub
Private Sub cmbTrmCde_SelectedIndexChanged(ByVal
sender As System.Object, ByVal e As System.EventArgs)
Handles cmbTrmCde.SelectedIndexChanged
Dim SelCde As String
If cmbTrmCde.SelectedValue.GetType.ToString
= "System.Data.DataRowView" Then
Dim dv As DataRowView
dv = cmbTrmCde.SelectedValue
Idx = cmbTrmCde.SelectedIndex
SelCde = dv("PymntCode")
Else
SelCde = cmbTrmCde.SelectedValue
Idx = cmbTrmCde.SelectedIndex
End If
..... ...
End Sub