Solved

datagrid event handling

Posted on 2004-09-08
2
176 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
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…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

752 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