0

i have the following code

Dim i As Integer

        i = Me.GridDomains.CurrentRow.Index
        Me.lbdomainid.Text = GridDomains.Item(0, i).Value

when i have complied it in visual studio 2010 (debug)

i get a error saying

system.data.sqlclient.sqlexceptions conversion faild when converting varchar value LBdomainID to data type int.

in sql the datatype is INT - i dont know what to do with the code above to remove this error

i have tryied
Cint(GridDomains.Item(0, i).Value).tostring but this doesnt work. thought i was so close with finishing my first .net program but was so wrong.

please help

2
Contributors
4
Replies
5
Views
6 Years
Discussion Span
Last Post by hercx
0

try this

Dim j As String
   
      j = Me.GridDomains.CurrentRow.Index
      Dim i As Integer = Integer.Parse(j)
      Me.lbdomainid.Text = GridDomains.Item(0, i).Value

hope this helps you

Edited by hercx: syntax error

0

hi thanks for this, i am unsure what this actualy does.

what i need it the lable if posible to contact a Int value from my Griddomains grid

0

ok this should work

Dim j As String
      j = Me.GridDomains.CurrentRow.Index
      Dim i As Integer = Integer.Parse(j)
      Me.lbdomainid.Text = GridDomains.Rows(i).Cells(0).Value

if you get an error with the code GridDomains.Rows(i).Cells(0).Value then change to
GridDomains.Rows(i).Cells(0).Value.ToString

hope this helps

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.