Click here to Skip to main content
15,886,724 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Everybody :)
I ran into a small problem continue writing my code.
What i try to do...
I have 2 forms.
Form2 contain a DataGridView, Where i want if i select a Row, to display on Form1, a specific table from other DB + a Picture in a PictureBox.
My code:

VB
  ' This is Form2 code

    Private Sub DataGridView1_RowHeaderMouseClick(sender As System.Object, e As System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles DataGridView1.RowHeaderMouseClick
        For Each cell As DataGridViewCell In DataGridView1.SelectedCells
            If cell.FormattedValue.Contains("Apple") Then
                form1.PictureBox1.ImageLocation = "C:\...\apple-logo.jpg"
                ' here i want to somehow display in the form1.DataGridView1 that is 
                ' located on Form1 a table name "Apple" 
            ElseIf cell.FormattedValue.Contains("Samsung") Then
                Me.PictureBox1.ImageLocation = "C:\...\samsung-logo.jpg"
                ' here i want to somehow display in the form1.DataGridView1 that is 
                ' located on Form1 a table name "Samsung" 
            End If
        Next
    End Sub
End Class


Well when i did with a Combobox, and on the same form:
with this code:
VB
Private Sub ComboBox1_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
        Select Case ComboBox1.SelectedItem
            Case "Apple" : table = "Apple"
            Case "Samsung" : table = "Samsungs"
            Case "other" : table = "All" 
    End Sub


But now i want to make from the DatagridView on form2, when i select a row and that row contain Apple or Samsung or other, to open in Form1 the picture + the Table in the form1.datagridView1

How can i realize that?
No more idea how can i do it...


Maybe it's like that?

VB
If cell.FormattedValue.Contains("ABC") Then
                Form1.PictureBox1.Image = My.Resources.cover
                Form1.TableAdapterManager.updateAll(form1.AppDataSet)

  

   ' i didn't try this one, and i am not sure in it... Need your Help! 


Thanks guys..
Posted
Comments
Maciej Los 3-Sep-15 15:21pm    
I had read your "question" to the end, but i haven't found any question... What's your issue?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900