vb.net - Check for a specific datatype in a datagridview -


is possible check if datagridview cell contains specific datatype. can’t find right syntax this. want.

if datagridview1.columns("name").valuetype = string  end if 

first loop through rows in datagridview, loop through cells in row. when looping through cells, check if cell.value string, integer, decimal , on.

here how:

    each row datagridviewrow in datagridview1.rows         each cell datagridviewcell in row.cells             if typeof (cell.value) string                 msgbox("this cell string!")             end if         next     next 

alternatively can loop through rows , immediatly check cells setting index... row.cells(0).value take first cell's value:

    each row datagridviewrow in datagridview1.rows         if typeof (row.cells(0).value) string             msgbox("string again!")         end if     next 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -