Click here to Skip to main content
15,903,362 members
Home / Discussions / Visual Basic
   

Visual Basic

 
Question.sendwait("08052") Pin
Mr kilany19-Apr-06 8:08
Mr kilany19-Apr-06 8:08 
AnswerRe: .sendwait("08052") Pin
Mr kilany22-Apr-06 3:36
Mr kilany22-Apr-06 3:36 
QuestionVB.NET/XML HELP URGENT Pin
samerali19-Apr-06 8:05
samerali19-Apr-06 8:05 
AnswerRe: VB.NET/XML HELP URGENT Pin
samerali19-Apr-06 8:06
samerali19-Apr-06 8:06 
AnswerRe: VB.NET/XML HELP URGENT Pin
Steve Pullan19-Apr-06 14:08
Steve Pullan19-Apr-06 14:08 
GeneralRe: VB.NET/XML HELP URGENT Pin
samerali19-Apr-06 14:17
samerali19-Apr-06 14:17 
QuestionDatagrid, DataSet Pin
dannygilbert319-Apr-06 7:46
dannygilbert319-Apr-06 7:46 
AnswerRe: Datagrid, DataSet Pin
cowtech27-Apr-06 13:20
cowtech27-Apr-06 13:20 
Hi Danny

I found a class on the net that changes the cell color according to what
information is placed in the cell, is this what your after? Below is how
I used it. Instead of a basic color I actually used a linear graded color in the cell, looks great in the grid.

Imports Microsoft.VisualBasic
Imports System
Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Windows.Forms

Public Class DataGridColoredTextBoxColumn
Inherits DataGridTextBoxColumn

Public Sub New()
'Warning: Implementation not found
End Sub

Protected Overloads Overrides Sub Paint(ByVal g As Graphics, ByVal bounds As Rectangle, ByVal source As CurrencyManager, ByVal rowNum As Integer, ByVal backBrush As Brush, ByVal foreBrush As Brush, ByVal alignToRight As Boolean)

' the idea is to conditionally set the foreBrush and/or backbrush
' depending upon some crireria on the cell value
' Here,we color anything that matches the select case
Try
Dim o As Object
o = Me.GetColumnValueAtRow(source, rowNum)
If (Not (o) Is Nothing) Then
Dim c As Char
Dim cellStr As String
c = CType(o, String).Substring(0, 1)
cellStr = CType(o, String)
Select Case cellStr
Case "**CRITICAL**"
backBrush = New LinearGradientBrush(bounds, Color.FromArgb(255, 50, 25), Color.FromArgb(128, 20, 20), LinearGradientMode.BackwardDiagonal)
foreBrush = New SolidBrush(Color.White)
Case "- URGENT -"
backBrush = New LinearGradientBrush(bounds, Color.FromArgb(255, 255, 255, 0), Color.FromArgb(200, 10, 0), LinearGradientMode.BackwardDiagonal)
foreBrush = New SolidBrush(Color.White)
Case "current"
backBrush = New LinearGradientBrush(bounds, Color.FromArgb(255, 10, 255, 0), Color.FromArgb(0, 50, 0), LinearGradientMode.BackwardDiagonal)
foreBrush = New SolidBrush(Color.White)
End Select
End If
Catch ex As Exception
' empty catch
Finally
' make sure the base class gets called to do the drawing with
' the possibly changed brushes
MyBase.Paint(g, bounds, source, rowNum, backBrush, foreBrush, alignToRight)
End Try

End Sub
End Class

It gets called like this.

Dim numCols As Integer
numCols = Me.m_openQueries.Tables(0).Columns.Count
Dim aColumnTextColumn As DataGridColoredTextBoxColumn
Dim i As Integer
i = 0

Do While (i < numCols)
aColumnTextColumn = New DataGridColoredTextBoxColumn()
aColumnTextColumn.HeaderText = m_openQueries.Tables(0).Columns (i).ColumnName
aColumnTextColumn.MappingName = m_openQueries.Tables(0).Columns(i).ColumnName
table_style.GridColumnStyles.Add(aColumnTextColumn)
i = (i + 1)

Loop

Hope this helps
cowtech
GeneralRe: Datagrid, DataSet Pin
dannygilbert328-Apr-06 2:24
dannygilbert328-Apr-06 2:24 
GeneralRe: Datagrid, DataSet Pin
cowtech15-May-06 13:27
cowtech15-May-06 13:27 
QuestionEnumerate MDIList Menu-item children Pin
paas19-Apr-06 5:58
paas19-Apr-06 5:58 
Questionusing an ActiveX created in VB6 within .Net 2 Pin
Jain Mohit19-Apr-06 4:34
Jain Mohit19-Apr-06 4:34 
QuestionMonitor User Activity Pin
alexfromto19-Apr-06 4:29
alexfromto19-Apr-06 4:29 
AnswerRe: Monitor User Activity Pin
Dave Kreskowiak19-Apr-06 5:37
mveDave Kreskowiak19-Apr-06 5:37 
GeneralRe: Monitor User Activity Pin
alexfromto19-Apr-06 6:44
alexfromto19-Apr-06 6:44 
GeneralRe: Monitor User Activity Pin
Dave Kreskowiak19-Apr-06 7:34
mveDave Kreskowiak19-Apr-06 7:34 
GeneralRe: Monitor User Activity Pin
alexfromto20-Apr-06 2:44
alexfromto20-Apr-06 2:44 
QuestionCrystal Reports Database Login Pin
Izak -19-Apr-06 4:14
Izak -19-Apr-06 4:14 
QuestionSlow application startup Pin
daveryan7819-Apr-06 3:58
daveryan7819-Apr-06 3:58 
AnswerRe: Slow application startup Pin
Yuvi Panda19-Apr-06 4:17
Yuvi Panda19-Apr-06 4:17 
GeneralRe: Slow application startup Pin
daveryan7819-Apr-06 23:08
daveryan7819-Apr-06 23:08 
QuestionVB6 equivalent for Static members in C? (Shared??) Pin
MohammadAmiry19-Apr-06 3:52
MohammadAmiry19-Apr-06 3:52 
AnswerRe: VB6 equivalent for Static members in C? (Shared??) Pin
Dave Kreskowiak19-Apr-06 5:25
mveDave Kreskowiak19-Apr-06 5:25 
AnswerRe: VB6 equivalent for Static members in C? (Shared??) Pin
Joshua Quick19-Apr-06 11:07
Joshua Quick19-Apr-06 11:07 
GeneralRe: VB6 equivalent for Static members in C? (Shared??) Pin
MohammadAmiry20-Apr-06 7:04
MohammadAmiry20-Apr-06 7:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.