Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

datagrid event handling

Posted on 2004-09-08
2
Medium Priority
?
180 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 1500 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

886 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