datagridview - Index was out of range. Must be non-negative and less than the size of the collection. but the column does exist -


i trying thought simple. take value 1 datagridview , add value in datagridview.

here code.

private sub deletebtn_click(byval sender system.object, byval e system.eventargs) handles deletebtn.click     dim sl = saleslinestbldatagridview     dim st = stocktbldatagridview     dim sti integer = st.currentrow.index     dim sli integer = sl.currentrow.index      if sl.rowcount = 0         msgbox("no sales lines delete!", msgboxstyle.okonly)     else         dim delm = msgbox("are sure want delete sales line?", msgboxstyle.yesno)         if delm = msgboxresult.yes             stocktblbindingsource.filter = string.format("id = '" & sl.item(13, sli).value & "'")              st.item(3, sti).value = val(st.item(3, sti).value) + val(sl.item(3, sli).value)             st.item(5, sti).value = val(st.item(5, sti).value) + val(sl.item(3, sli).value)             saleslinestblbindingnavigator.deleteitem.performclick()             resetbtn.performclick()         end if     end if end sub 

it erroring on

 st.item(3, sti).value = val(st.item(3, sti).value) + val(sl.item(3, sli).value) 

with exception in title.

can please help.

all working now. never found out wrong splitting code 2 buttons , using button2.perform click worked. not sure difference made splitting code after filter , little messier wanted working now.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -