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
Solved

Datagrid Row Selections

Posted on 2004-09-08
2
312 Views
Last Modified: 2012-05-05
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.

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 10

Accepted Solution

by:
123654789987 earned 500 total points
ID: 12014643
Private Sub datagridClick(ByVal sender As System.Object, _
    ByVal e As MouseEventArgs) Handles datagrid.MouseDown
        Dim mouseClick As DataGrid.HitTestInfo
        Dim descIndex As Integer
        dim picIndex as integer

        If e.Button = MouseButtons.Left Then
            dgObservation = CType(sender, DataGrid)
            mouseClick = datagrid.HitTest(e.X, e.Y)
            gridRow = mouseClick.Row
         
                descIndex = datagrid.Columns.IndexOf("Desc")
                picIndex  =  datagrid.Columns.IndexOf("Pic")

               
                If gridRow >= 0 Then
                    textbox1.Text = datagrid.Rows(gridRow)(descIndex ).ToString
                     pictureBox.Image =    datagrid.Rows(gridRow)(picIndex) // Set the picture to the box
                End If
            End If
End Sub
0
 

Author Comment

by:malanois
ID: 12019997
Thank You,

it worked 99%.

I had to throw a loop in there if the pic value was null not to load.  However I still cannot get an image to show in my pic box.

The database has the image file name in the image column.  1234.jpg, I have also tried \\1234.jpg, \\trdb\image\1234.jpg

And it still wont load the image.  however i dont get and error on those though....

MJ
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying 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

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

860 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