Change image of a datagriview cell at runtime

RIAS
RIAS used Ask the Experts™
on
Hi,
Need to change the image of datagridview cell at run time.
dgv1.rows(1).cells(0).value=my.resources.tick
doesn't work
Any other suggestions are greatly appreciated!
Cheers
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
IT Pro/Developer
Top Expert 2008
Commented:
Any error ?
How about this way:
Dim newImage As DataGridViewImageCell = dgv1(0, 1)
newImage.Value = My.Resources.tick
You can try to refresh the grid after change the image also.
Check some handling with the datagridview:
http://www.codeproject.com/KB/grid/MergedDataGridViewControl.aspx 

Author

Commented:
Hi,
Thanks for the reply.It didn't work.There is no error as well but no image
Jorge PaulinoIT Pro/Developer
Top Expert 2008

Commented:
Have you tried to refresh the row ?

Me.DataGridView1.Refresh()
 
Can you show some more code?
Success in ‘20 With a Profitable Pricing Strategy

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Author

Commented:
Hi,
  What exactly I am doing here is I have 3 tabs with a datagridview each.
When user selects one cell from tab1 I have to selected a relative cell on tab 3 which is indiacted by tick.
Now when I select a cell on tab 1 there are no ticks on tab3 but when I again delect the tick on tab1 I can see ticks on tab3 dgv3.
Any suggestions?
Thanks for helping me
  If e.RowIndex <> PrevRowIndex Then
                                            Dim newImage As DataGridViewImageCell = Dg(2).Item(0, i)
                                            newImage.Value = My.Resources.Tick
                                            Dg(2).Refresh()
                                            FrmMain.TabPage3.Refresh()
                                            RptSelected = False
                                            PrevRowIndex = e.RowIndex
                                            'End If
                                            'Add/ Remove report from files list
                                            ReportSelect(Recordreader("ReportType").ToString(), Recordreader("ReportFile").ToString().ToUpper, Removeitem)
 
                                            Exit For
                                        End If

Open in new window

Jorge PaulinoIT Pro/Developer
Top Expert 2008

Commented:
Check if you're trying to set the image to the right column ? Use the column name and not the column index to have sure.

Author

Commented:
Hi,
Found a way of doing it ..your code worked only change was I needed to select all tabs before I clicked on the cell on tab1 to get a cell on tab3 selected.strange but it worked ..cheeers mate

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial