Conversion from type 'DataRowView' to type 'String' is not valid

  • Thread starter Thread starter AliMonMK
  • Start date Start date
A

AliMonMK

Guest
Dear friends,

my form load event is follows for combo box which work perfectly.

con.Open()


Dim cmd As String = "select ACID,Account from vbank"
Dim da1 As New SqlDataAdapter(cmd, con)
da1.Fill(ds, "vbank")
cbbank.DataSource = ds.Tables("vbank")
cbbank.DisplayMember = "Account"
cbbank.ValueMember = "ACID"
con.close()

When i am editing the data by edit event I need to show the data gridview first row "credit" column value to be shown in combo box. following is the code i am using. But i am getting error "Conversion from type 'DataRowView' to type 'String' is not valid".

Kindly help me..

Dim val As Integer = DirectCast(DGV.Rows(0).Cells("Credit").Value, Integer)
cbbank.SelectedValue = val


cbbank.Text = cbbank.SelectedItem

Continue reading...
 
Back
Top