Solved

datagrid event handling

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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

706 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

21 Experts available now in Live!

Get 1:1 Help Now