473,490 Members | 2,737 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Images in a Windows DataGrid

WINDOWS APPLICATION

I have to port a Web application to a Windows application.

I've no experience of Windows apps in .NET, though I've been doing Web
apps in ASP.NET since it came out.

I have a normal System.Windows.Forms.DataGrid. I wish to display an
image in each cell alongside some text - the image would be conditional
upon the value in the cell.

How can I do this in a Windows app? In the Web app I put it in the
Grid_ItemDataBound event:

[...]

With e.Item.Cells.Item(cell)
.Font.Bold = True
err = GetRuleFailureDescription(startArbStatus, endArbStatus,
durationArbStatus, _
IIf(hours Is DBNull.Value, 0.0, hours), ruleID)

.Text = "<IMG" & _
" title=" & Chr(34) & err & Chr(34) & _
" id=" & Chr(34) & ID & "Mon" & Chr(34) & _
" runat=" & Chr(34) & "server" & Chr(34) & _
" height=" & Chr(34) & "16" & Chr(34) & _
" width=" & Chr(34) & "16" & Chr(34) & _
" src=" & Chr(34) & "../../images/incident16.gif" & Chr(34) & _
" align=" & Chr(34) & "left" & Chr(34) & _
" onclick=" & Chr(34) &
"javascript:document.getElementById('txtArb').valu e = 'true'" & Chr(34)
& _
">" & .Text
End With

Thanks for any help anyone can offer.

Edward

Jul 7 '06 #1
1 1313

te********@hotmail.com wrote:
WINDOWS APPLICATION

I have to port a Web application to a Windows application.

I've no experience of Windows apps in .NET, though I've been doing Web
apps in ASP.NET since it came out.

I have a normal System.Windows.Forms.DataGrid. I wish to display an
image in each cell alongside some text - the image would be conditional
upon the value in the cell.

How can I do this in a Windows app? In the Web app I put it in the
Grid_ItemDataBound event:

[...]

With e.Item.Cells.Item(cell)
.Font.Bold = True
err = GetRuleFailureDescription(startArbStatus, endArbStatus,
durationArbStatus, _
IIf(hours Is DBNull.Value, 0.0, hours), ruleID)

.Text = "<IMG" & _
" title=" & Chr(34) & err & Chr(34) & _
" id=" & Chr(34) & ID & "Mon" & Chr(34) & _
" runat=" & Chr(34) & "server" & Chr(34) & _
" height=" & Chr(34) & "16" & Chr(34) & _
" width=" & Chr(34) & "16" & Chr(34) & _
" src=" & Chr(34) & "../../images/incident16.gif" & Chr(34) & _
" align=" & Chr(34) & "left" & Chr(34) & _
" onclick=" & Chr(34) &
"javascript:document.getElementById('txtArb').valu e = 'true'" & Chr(34)
& _
">" & .Text
End With

Thanks for any help anyone can offer.

Edward
I am not sure of this, but perhaps you can research it.

In a Windows DataGrid you can have TableStyles, which have
DataGridColumnStyles. DatGridColumnStyle itself cannot be instanitated,
but it's derivative types can. The two easily availible are
DataGridTextColumn and DataGridBoolColumn. Perhaps there is one
availible for images?

I just starting messing with TableStyles so i'm not too familiar with
it yet.
B.

Jul 7 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1937
by: Celine | last post by:
I am building a website using C#, asp.net and SqlServer. I need to store a lot of images in my database. I need to store thumbnails but also larger pictures(when user clicks thumbnails a larger...
1
2442
by: Val | last post by:
I am just tryong to figure out how to display images in a Windows Form DataGrid. I would apreciate help and code samples. Thanks a lot.
2
5121
by: John Do | last post by:
Hi, I want to store the path and the name of the images in a sql 2000 database and all the images in a folder named images. And then I want to display all the images in a datagrid. Does any one...
13
1592
by: moondaddy | last post by:
Happy Holidays All! I want to load a datagrid with images and text (Image, text, image, text, etc...). The data for this datagrid will be coming from sql server and the images are stored as files...
9
4587
by: tshad | last post by:
Is there a way to use your own image in place of the automatic one that ASP uses when doing editing in your DataGrid pages? We already have a style of button we are using and would like to be...
0
1040
by: Tim::.. | last post by:
Please, please, please help!!! I have a datagrid that displays a list of contacts on our intranet site using the ActiveDirectory as it's main Data Source. I want to be able to show an image of...
9
3813
by: Wayne Smith | last post by:
I've come up against a major headache that I can't seem to find a solution for but I'm sure there must be a workaround and I would really be grateful of any help. I'm currently building a web...
76
2895
by: rcoco | last post by:
Hi all, I'm facing this problem I have images on my website but when I Deploye the website on server the Images are not there I only get the X sign. How can I go about this. Thanks
2
2777
by: pozze | last post by:
Hi, I need to display images and other record information retrieved from an SQL 2005 database in a datagrid on a web page. I'm coding in VB .net I have recently changed over from VB ASP and i'm...
0
6974
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7146
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6852
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7356
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4878
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4573
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3074
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1389
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
628
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.