hello all.. i'm new ni vb.net
i need help. i got problem how to pass datagrid value to textbox.

i have two from. Form1 is textbox and form2 is datagrid.
what i want to do is to pass the selected value from datagrid(form2) to textbox(Form1).

im using vb.net 2003
thank you..

you could save the value in the datagridview to a public variable and then access the variable from the other form. It will have the same value.

you can pass the selected rows of the datagridview cell vlue through on click of datagridview _cellClick event
like

dim id as Integer
id = Convert.ToInt32(datagridview.Rows[e.RowIndex].Cells["ID"].Value.ToString()))

//where ID is the name of the column.

you could save the value in the datagridview to a public variable and then access the variable from the other form. It will have the same value.

Im not using datagridview. Im using DataGrid(vb.net 2003)..
thanks roottybrian

you can pass the selected rows of the datagridview cell vlue through on click of datagridview _cellClick event
like

dim id as Integer
id = Convert.ToInt32(datagridview.Rows[e.RowIndex].Cells["ID"].Value.ToString()))

//where ID is the name of the column.

Im using vb.net 2003.

this code i did:

Dim Aid, i As Integer
Aid = Convert.ToInt32(DataGrid1.CurrentRowIndex[e.RowIndex].Cells["Asset_ID"].Value.ToString()))

if i put e.RowIndex, my coding is error.

thank you pritesh2010

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.