I'm developing an application for Pocket PC in VB .NET. My grid can contain
up to 10 rows, but my table has only 2 and I see the dark gray area. Is there
a way to change the color of it? 'DataGrid1.BackgroundColor' works for a
Windows Application, but not Smart Device Application...

Re: How to make the gray area of the grid white? by Tim

Tim
Fri Apr 01 17:42:28 CST 2005

Here's an example of how to do this. It's in C# but should be easily
translated to VB.Net.
http://opennetcf.org/Forums/topic.asp?TOPIC_ID=229

--
Tim Wilson
.Net Compact Framework MVP

"Eve" <Eve@discussions.microsoft.com> wrote in message
news:758B3334-9A44-451B-A3F6-AD7163B5D61B@microsoft.com...
> I'm developing an application for Pocket PC in VB .NET. My grid can
contain
> up to 10 rows, but my table has only 2 and I see the dark gray area. Is
there
> a way to change the color of it? 'DataGrid1.BackgroundColor' works for a
> Windows Application, but not Smart Device Application...



Re: How to make the gray area of the grid white? by Eve

Eve
Tue Apr 05 14:41:04 CDT 2005

Thanks for your help. I'm not sure how to translate it...

"Tim Wilson" wrote:

> Here's an example of how to do this. It's in C# but should be easily
> translated to VB.Net.
> http://opennetcf.org/Forums/topic.asp?TOPIC_ID=229
>
> --
> Tim Wilson
> ..Net Compact Framework MVP
>
> "Eve" <Eve@discussions.microsoft.com> wrote in message
> news:758B3334-9A44-451B-A3F6-AD7163B5D61B@microsoft.com...
> > I'm developing an application for Pocket PC in VB .NET. My grid can
> contain
> > up to 10 rows, but my table has only 2 and I see the dark gray area. Is
> there
> > a way to change the color of it? 'DataGrid1.BackgroundColor' works for a
> > Windows Application, but not Smart Device Application...
>
>
>

Re: How to make the gray area of the grid white? by Tim

Tim
Tue Apr 05 15:37:18 CDT 2005

I haven't tested the code below, but it looks pretty good. I got this code
from the following translator. I modified it slightly.
http://www.kamalpatel.net/ConvertCSharp2VB.aspx

Imports System.Reflection

Public Shared Sub SetGridBackColor(ByVal dg As DataGrid, ByVal clr As
Color)
Dim oRenderer As Object = Type.GetType(DataGrid).GetField("m_renderer",
BindingFlags.NonPublic Or BindingFlags.Instance).GetValue(dg)
oRenderer.GetType().GetField("m_brushEmptyBack", BindingFlags.NonPublic Or
BindingFlags.Instance).SetValue(oRenderer, New SolidBrush(clr))
End Sub

--
Tim Wilson
.Net Compact Framework MVP

"Eve" <Eve@discussions.microsoft.com> wrote in message
news:19C2742C-1026-4A3D-9A42-75723D3D7D7E@microsoft.com...
> Thanks for your help. I'm not sure how to translate it...
>
> "Tim Wilson" wrote:
>
> > Here's an example of how to do this. It's in C# but should be easily
> > translated to VB.Net.
> > http://opennetcf.org/Forums/topic.asp?TOPIC_ID=229
> >
> > --
> > Tim Wilson
> > ..Net Compact Framework MVP
> >
> > "Eve" <Eve@discussions.microsoft.com> wrote in message
> > news:758B3334-9A44-451B-A3F6-AD7163B5D61B@microsoft.com...
> > > I'm developing an application for Pocket PC in VB .NET. My grid can
> > contain
> > > up to 10 rows, but my table has only 2 and I see the dark gray area.
Is
> > there
> > > a way to change the color of it? 'DataGrid1.BackgroundColor' works for
a
> > > Windows Application, but not Smart Device Application...
> >
> >
> >



Re: How to make the gray area of the grid white? by Eve

Eve
Tue Apr 05 16:15:02 CDT 2005

I'm getting this error:
"'DataGrid' is a type and cannot be used as an expression",
which is pointing to "Type.GetType(DataGrid)...."

"Tim Wilson" wrote:

> I haven't tested the code below, but it looks pretty good. I got this code
> from the following translator. I modified it slightly.
> http://www.kamalpatel.net/ConvertCSharp2VB.aspx
>
> Imports System.Reflection
>
> Public Shared Sub SetGridBackColor(ByVal dg As DataGrid, ByVal clr As
> Color)
> Dim oRenderer As Object = Type.GetType(DataGrid).GetField("m_renderer",
> BindingFlags.NonPublic Or BindingFlags.Instance).GetValue(dg)
> oRenderer.GetType().GetField("m_brushEmptyBack", BindingFlags.NonPublic Or
> BindingFlags.Instance).SetValue(oRenderer, New SolidBrush(clr))
> End Sub
>
> --
> Tim Wilson
> ..Net Compact Framework MVP
>
> "Eve" <Eve@discussions.microsoft.com> wrote in message
> news:19C2742C-1026-4A3D-9A42-75723D3D7D7E@microsoft.com...
> > Thanks for your help. I'm not sure how to translate it...
> >
> > "Tim Wilson" wrote:
> >
> > > Here's an example of how to do this. It's in C# but should be easily
> > > translated to VB.Net.
> > > http://opennetcf.org/Forums/topic.asp?TOPIC_ID=229
> > >
> > > --
> > > Tim Wilson
> > > ..Net Compact Framework MVP
> > >
> > > "Eve" <Eve@discussions.microsoft.com> wrote in message
> > > news:758B3334-9A44-451B-A3F6-AD7163B5D61B@microsoft.com...
> > > > I'm developing an application for Pocket PC in VB .NET. My grid can
> > > contain
> > > > up to 10 rows, but my table has only 2 and I see the dark gray area.
> Is
> > > there
> > > > a way to change the color of it? 'DataGrid1.BackgroundColor' works for
> a
> > > > Windows Application, but not Smart Device Application...
> > >
> > >
> > >
>
>
>

Re: How to make the gray area of the grid white? by Tim

Tim
Tue Apr 05 16:33:59 CDT 2005

The following code works.

Public Shared Sub SetGridBackColor(ByVal dg As DataGrid, ByVal clr As Color)

Dim oRenderer As Object = dg.GetType().GetField("m_renderer",
BindingFlags.NonPublic Or BindingFlags.Instance).GetValue(dg)

oRenderer.GetType().GetField("m_brushEmptyBack", BindingFlags.NonPublic Or
BindingFlags.Instance).SetValue(oRenderer, New SolidBrush(clr))

dg.Invalidate()

End Sub

--
Tim Wilson
.Net Compact Framework MVP

"Eve" <Eve@discussions.microsoft.com> wrote in message
news:A44A21A1-5A9F-4A3B-A7A1-8FB835D757AB@microsoft.com...
> I'm getting this error:
> "'DataGrid' is a type and cannot be used as an expression",
> which is pointing to "Type.GetType(DataGrid)...."
>
> "Tim Wilson" wrote:
>
> > I haven't tested the code below, but it looks pretty good. I got this
code
> > from the following translator. I modified it slightly.
> > http://www.kamalpatel.net/ConvertCSharp2VB.aspx
> >
> > Imports System.Reflection
> >
> > Public Shared Sub SetGridBackColor(ByVal dg As DataGrid, ByVal clr As
> > Color)
> > Dim oRenderer As Object =
Type.GetType(DataGrid).GetField("m_renderer",
> > BindingFlags.NonPublic Or BindingFlags.Instance).GetValue(dg)
> > oRenderer.GetType().GetField("m_brushEmptyBack",
BindingFlags.NonPublic Or
> > BindingFlags.Instance).SetValue(oRenderer, New SolidBrush(clr))
> > End Sub
> >
> > --
> > Tim Wilson
> > ..Net Compact Framework MVP
> >
> > "Eve" <Eve@discussions.microsoft.com> wrote in message
> > news:19C2742C-1026-4A3D-9A42-75723D3D7D7E@microsoft.com...
> > > Thanks for your help. I'm not sure how to translate it...
> > >
> > > "Tim Wilson" wrote:
> > >
> > > > Here's an example of how to do this. It's in C# but should be easily
> > > > translated to VB.Net.
> > > > http://opennetcf.org/Forums/topic.asp?TOPIC_ID=229
> > > >
> > > > --
> > > > Tim Wilson
> > > > ..Net Compact Framework MVP
> > > >
> > > > "Eve" <Eve@discussions.microsoft.com> wrote in message
> > > > news:758B3334-9A44-451B-A3F6-AD7163B5D61B@microsoft.com...
> > > > > I'm developing an application for Pocket PC in VB .NET. My grid
can
> > > > contain
> > > > > up to 10 rows, but my table has only 2 and I see the dark gray
area.
> > Is
> > > > there
> > > > > a way to change the color of it? 'DataGrid1.BackgroundColor' works
for
> > a
> > > > > Windows Application, but not Smart Device Application...
> > > >
> > > >
> > > >
> >
> >
> >



Re: How to make the gray area of the grid white? by Eve

Eve
Tue Apr 05 16:55:02 CDT 2005

Yes, it works! I'm so grateful! Thank you so much!

"Tim Wilson" wrote:

> The following code works.
>
> Public Shared Sub SetGridBackColor(ByVal dg As DataGrid, ByVal clr As Color)
>
> Dim oRenderer As Object = dg.GetType().GetField("m_renderer",
> BindingFlags.NonPublic Or BindingFlags.Instance).GetValue(dg)
>
> oRenderer.GetType().GetField("m_brushEmptyBack", BindingFlags.NonPublic Or
> BindingFlags.Instance).SetValue(oRenderer, New SolidBrush(clr))
>
> dg.Invalidate()
>
> End Sub
>
> --
> Tim Wilson
> ..Net Compact Framework MVP
>
> "Eve" <Eve@discussions.microsoft.com> wrote in message
> news:A44A21A1-5A9F-4A3B-A7A1-8FB835D757AB@microsoft.com...
> > I'm getting this error:
> > "'DataGrid' is a type and cannot be used as an expression",
> > which is pointing to "Type.GetType(DataGrid)...."
> >
> > "Tim Wilson" wrote:
> >
> > > I haven't tested the code below, but it looks pretty good. I got this
> code
> > > from the following translator. I modified it slightly.
> > > http://www.kamalpatel.net/ConvertCSharp2VB.aspx
> > >
> > > Imports System.Reflection
> > >
> > > Public Shared Sub SetGridBackColor(ByVal dg As DataGrid, ByVal clr As
> > > Color)
> > > Dim oRenderer As Object =
> Type.GetType(DataGrid).GetField("m_renderer",
> > > BindingFlags.NonPublic Or BindingFlags.Instance).GetValue(dg)
> > > oRenderer.GetType().GetField("m_brushEmptyBack",
> BindingFlags.NonPublic Or
> > > BindingFlags.Instance).SetValue(oRenderer, New SolidBrush(clr))
> > > End Sub
> > >
> > > --
> > > Tim Wilson
> > > ..Net Compact Framework MVP
> > >
> > > "Eve" <Eve@discussions.microsoft.com> wrote in message
> > > news:19C2742C-1026-4A3D-9A42-75723D3D7D7E@microsoft.com...
> > > > Thanks for your help. I'm not sure how to translate it...
> > > >
> > > > "Tim Wilson" wrote:
> > > >
> > > > > Here's an example of how to do this. It's in C# but should be easily
> > > > > translated to VB.Net.
> > > > > http://opennetcf.org/Forums/topic.asp?TOPIC_ID=229
> > > > >
> > > > > --
> > > > > Tim Wilson
> > > > > ..Net Compact Framework MVP
> > > > >
> > > > > "Eve" <Eve@discussions.microsoft.com> wrote in message
> > > > > news:758B3334-9A44-451B-A3F6-AD7163B5D61B@microsoft.com...
> > > > > > I'm developing an application for Pocket PC in VB .NET. My grid
> can
> > > > > contain
> > > > > > up to 10 rows, but my table has only 2 and I see the dark gray
> area.
> > > Is
> > > > > there
> > > > > > a way to change the color of it? 'DataGrid1.BackgroundColor' works
> for
> > > a
> > > > > > Windows Application, but not Smart Device Application...
> > > > >
> > > > >
> > > > >
> > >
> > >
> > >
>
>
>

Re: How to make the gray area of the grid white? by Tim

Tim
Tue Apr 05 17:15:14 CDT 2005

Just as FYI, if you post to the official Compact Framework newsgroup
(microsoft.public.dotnet.framework.compactframework) you'll usually get a
quicker reply.

--
Tim Wilson
.Net Compact Framework MVP

"Eve" <Eve@discussions.microsoft.com> wrote in message
news:8EAA5CC5-6004-4661-8588-47F742685E5C@microsoft.com...
> Yes, it works! I'm so grateful! Thank you so much!
>
> "Tim Wilson" wrote:
>
> > The following code works.
> >
> > Public Shared Sub SetGridBackColor(ByVal dg As DataGrid, ByVal clr As
Color)
> >
> > Dim oRenderer As Object = dg.GetType().GetField("m_renderer",
> > BindingFlags.NonPublic Or BindingFlags.Instance).GetValue(dg)
> >
> > oRenderer.GetType().GetField("m_brushEmptyBack",
BindingFlags.NonPublic Or
> > BindingFlags.Instance).SetValue(oRenderer, New SolidBrush(clr))
> >
> > dg.Invalidate()
> >
> > End Sub
> >
> > --
> > Tim Wilson
> > ..Net Compact Framework MVP
> >
> > "Eve" <Eve@discussions.microsoft.com> wrote in message
> > news:A44A21A1-5A9F-4A3B-A7A1-8FB835D757AB@microsoft.com...
> > > I'm getting this error:
> > > "'DataGrid' is a type and cannot be used as an expression",
> > > which is pointing to "Type.GetType(DataGrid)...."
> > >
> > > "Tim Wilson" wrote:
> > >
> > > > I haven't tested the code below, but it looks pretty good. I got
this
> > code
> > > > from the following translator. I modified it slightly.
> > > > http://www.kamalpatel.net/ConvertCSharp2VB.aspx
> > > >
> > > > Imports System.Reflection
> > > >
> > > > Public Shared Sub SetGridBackColor(ByVal dg As DataGrid, ByVal clr
As
> > > > Color)
> > > > Dim oRenderer As Object =
> > Type.GetType(DataGrid).GetField("m_renderer",
> > > > BindingFlags.NonPublic Or BindingFlags.Instance).GetValue(dg)
> > > > oRenderer.GetType().GetField("m_brushEmptyBack",
> > BindingFlags.NonPublic Or
> > > > BindingFlags.Instance).SetValue(oRenderer, New SolidBrush(clr))
> > > > End Sub
> > > >
> > > > --
> > > > Tim Wilson
> > > > ..Net Compact Framework MVP
> > > >
> > > > "Eve" <Eve@discussions.microsoft.com> wrote in message
> > > > news:19C2742C-1026-4A3D-9A42-75723D3D7D7E@microsoft.com...
> > > > > Thanks for your help. I'm not sure how to translate it...
> > > > >
> > > > > "Tim Wilson" wrote:
> > > > >
> > > > > > Here's an example of how to do this. It's in C# but should be
easily
> > > > > > translated to VB.Net.
> > > > > > http://opennetcf.org/Forums/topic.asp?TOPIC_ID=229
> > > > > >
> > > > > > --
> > > > > > Tim Wilson
> > > > > > ..Net Compact Framework MVP
> > > > > >
> > > > > > "Eve" <Eve@discussions.microsoft.com> wrote in message
> > > > > > news:758B3334-9A44-451B-A3F6-AD7163B5D61B@microsoft.com...
> > > > > > > I'm developing an application for Pocket PC in VB .NET. My
grid
> > can
> > > > > > contain
> > > > > > > up to 10 rows, but my table has only 2 and I see the dark gray
> > area.
> > > > Is
> > > > > > there
> > > > > > > a way to change the color of it? 'DataGrid1.BackgroundColor'
works
> > for
> > > > a
> > > > > > > Windows Application, but not Smart Device Application...
> > > > > >
> > > > > >
> > > > > >
> > > >
> > > >
> > > >
> >
> >
> >