Datagridview : TextAndImageColumn

Ultrawhack

Well-known member
Joined
Jul 5, 2006
Messages
164
Location
Canada
Programming Experience
3-5
Can anyone please point me to a sample where I can see how textandimagecolumn works in a datagridview. I'd like to include an icon with the column1 text.

Thanks !
 
Thanks for the link to DGV FAQ, lingsn - useful!
 
Thanks lingsn. Do you have any sample code to programmatically simply pop an icon into a textandimage column or image column ? I've been looking but there's not much out there.
 
Thanks very much for that sample. That explains a lot. I wonder if I could get your help on the following.

I have SourceDGV1, SourceDGV2 and TargetDGV.
TargetDGV has a image column. SourceDGVs do not.

I drag an item from SourceDGV1 and drop it onto TargetDGV. How can I get a unique image to appear in the image column1 of TargetDGV to show it came from SourceDGV1 ? Column2 will be the dragged item. Same with SourceDGV2.

If dropped item is from SourceDGV1 THEN TargetDGV's column1 is image1
If dropped item is from SourceDGV2 THEN TargetDGV's column1 is image2

Hope I've explained it good. I'm trying to figure this out with no success yet. Thanks !
 
Add a variable and store the info you need when starting the dragdrop operation, when dropping you just check your info.
 
Here is the basics in pseudo:
VB.NET:
dim intiator as string 
 
Sub SourceDGV1_MouseDown
  initiator="SourceDGV1"
  start dragop
end sub
 
Sub SourceDGV2_MouseDown
  initiator="SourceDGV2"
  start dragop
end sub
 
Sub TargetDGV_DragDrop
if initiator = "SourceDGV1" then
  drop from source1
elseif initiator="SourceDGV2"
  drop from source2
end if
end sub
 
Back
Top