I have done like this for sending gridview row values from one form to another
i have datagrid view with columns productdescription , productimage , productname
my main aim is if, i select the image cell in datagridview the selected image and the values of row which row has that image need to send to another form …
in the below code only image will be transferred to another form i need to send another values also …
i have searched a lot but i didnot find any solution.. and the code is given below….
private void productGridview_Cellclick(object sender, DataGridViewCellEventArgs e)
{
byte[] bits = null;
Image img = null;
if (e.ColumnIndex != productgridview.Columns["productimage"].Index) return;
if (productgridview.SelectedCells.Count == 0) return;
bits = (byte[])productgridview.SelectedCells[0].Value;
img = bytearraytoimage(bits);
if (img is Image)
{
using (ProductDescriptionForm pf = new ProductDescriptionForm())
{
pf.picture = img;
pf.ShowDialog(this);
}
}
}
and in productdescription form i have defined like this …
public partial class ProductDescriptionForm : Form
{
public ProductDescriptionForm()
{
InitializeComponent();
}
public Image picture
{
get { return pictureBox1.Image; }
set { pictureBox1.Image = value; }
}
}
how do i transfer other values in the same row that has the image to another form
I am using winforms….
many thanks in advance….
do i need to change the cell click event to row click event ?????
if so , how do i check the particular cell with image in datagridview
would any suggestions any bit of code would be helpful to me
I have solved My problem by using the following way