Solved

datagrid event handling

Posted on 2004-09-08
2
175 Views
Last Modified: 2010-05-18
This has been bothering me for a while now.  I am using OLEDbAdapter to fill a dataset.  The dataset is filling a data grid.  I have a Column that is not visible in the normal Datagrid.  When a user selects a given row in the datagrid I need to fill 2 seperate items.  1 being a picture box, the other being a txt box.

And it needs to change everytime they select a new row.


The select statement has PN, TR_Desc, Desc, Pic, Vendor

Desc is not being shown in the main datagrid.



I need Pic to show in the Picture Box (pbx1)
and
Desc to fill in another Text Box (txtbx2)

Any suggestions will help

MJ
0
Comment
Question by:malanois
2 Comments
 
LVL 8

Expert Comment

by:gregasm
ID: 12012369
catch the selectedRowIndexChanged event.

In that event, you can use the currentRowIndex of the grid to figure out which PIC and TEXT to display.
0
 
LVL 25

Accepted Solution

by:
RonaldBiemans earned 500 total points
ID: 12015282
Hi malanois,

Web or winforms,

if winforms,

just set the textbox databindings

like yourtextbox.databindings.add("text",yourdataset.tables(0),"Desc")

for the picturebox its a bit more work

in the currentcellchanged event of your datagrid do something like this

            Dim bytBLOBData() As Byte = _
                ds.Tables(0).Rows(yourdatagrid.currentrowindex).item("pic")
            Dim stmBLOBData As New MemoryStream(bytBLOBData)
            yourpicturebox.Image = Image.FromStream(stmBLOBData)
        End If
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question