Solved

datagrid event handling

Posted on 2004-09-08
2
173 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

862 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now