473,378 Members | 1,429 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Overload resolution failed because no 'Paint' is accessible.

I have been staring at the above error for over a week now! I have a
an inherited data class looking like thus:

Public Class DataGridBoolColumnInherit
Inherits System.Windows.Forms.DataGridBoolColumn

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)

---------------------

Then in my Main() I have the following relevent code:

Friend WithEvents DataGridBoolColumnInherit1 As
DataGridBoolColumnInherit
Me.DataGridBoolColumnInherit1 = New DataGridBoolColumnInherit()

Public Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

Dim dgt As DataGridTableStyle = Main_DataGrid.TableStyles(0)

Dim cm As CurrencyManager = CType(Me.BindingContext _
(Main_DataSet.Tables(dgt.MappingName)), CurrencyManager)

Dim cellRect As Rectangle
Dim cellrow As Integer = 5
Dim cellcolumn As Integer = 1
cellRect = Main_DataGrid.GetCellBounds(3, 0)
hehe = dgt.GridColumnStyles(0)
Dim gridCol As MyGridColumn
Dim graph As Graphics = Main_DataGrid.CreateGraphics()
Dim fBrush As New SolidBrush(Color.Yellow)
Dim bBrush As New SolidBrush(Color.Yellow)
DataGridBoolColumnInherit1.Paint(graph, cellRect, cm, cellrow,
bBrush,
fbrush, False)
For some reason the program does not "see" the Paint method inherited
from datagridboolcolumn. This problem has "simple answer" written all
over it. But I don't see it! Can anyone else? Please?

Mike Cooper
Nov 20 '05 #1
3 1958
Mike,
Protected Overloads Overrides Sub Paint(ByVal g As Graphics, ByVal The Paint method of DataGridBoolColumn is Protected, this means that only
the DataGridBoolColumn class or a class derived from it can use the method.

The Button1_Click is not a member of the DataGridBoolColumn class or a class
derived from it, so Button1_Click cannot use the method.

Hope this helps
Jay

"Mike Cooper" <bi******@yahoo.com> wrote in message
news:8b**************************@posting.google.c om... I have been staring at the above error for over a week now! I have a
an inherited data class looking like thus:

Public Class DataGridBoolColumnInherit
Inherits System.Windows.Forms.DataGridBoolColumn

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)

---------------------

Then in my Main() I have the following relevent code:

Friend WithEvents DataGridBoolColumnInherit1 As
DataGridBoolColumnInherit
Me.DataGridBoolColumnInherit1 = New DataGridBoolColumnInherit()

Public Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

Dim dgt As DataGridTableStyle = Main_DataGrid.TableStyles(0)

Dim cm As CurrencyManager = CType(Me.BindingContext _
(Main_DataSet.Tables(dgt.MappingName)), CurrencyManager)

Dim cellRect As Rectangle
Dim cellrow As Integer = 5
Dim cellcolumn As Integer = 1
cellRect = Main_DataGrid.GetCellBounds(3, 0)
hehe = dgt.GridColumnStyles(0)
Dim gridCol As MyGridColumn
Dim graph As Graphics = Main_DataGrid.CreateGraphics()
Dim fBrush As New SolidBrush(Color.Yellow)
Dim bBrush As New SolidBrush(Color.Yellow)
DataGridBoolColumnInherit1.Paint(graph, cellRect, cm, cellrow,
bBrush,
fbrush, False)
For some reason the program does not "see" the Paint method inherited
from datagridboolcolumn. This problem has "simple answer" written all
over it. But I don't see it! Can anyone else? Please?

Mike Cooper

Nov 20 '05 #2
Hello Jay,

Thank you for responding. I guess the large gaps in my knowledge of
visual basic are showing. Can you elaborate? I had assumed that
objects of classes could be instantiated anywhere with full access to
there own defined methods. In my code in I created an object of my
datagridboolcolumninherit class, and tried to have it execute its
paint method. The humble purpose of the code I showed was to color a
certain datagrid cell whenever a button was pushed. How would a
button click color a cell if not through the datagrid's own paint
method?

Thank you,
Mike Cooper

"Jay B. Harlow [MVP - Outlook]" <Ja********@email.msn.com> wrote in message news:<OX**************@TK2MSFTNGP10.phx.gbl>...
Mike,
Protected Overloads Overrides Sub Paint(ByVal g As Graphics, ByVal

The Paint method of DataGridBoolColumn is Protected, this means that only
the DataGridBoolColumn class or a class derived from it can use the method.

The Button1_Click is not a member of the DataGridBoolColumn class or a class
derived from it, so Button1_Click cannot use the method.

Hope this helps
Jay

"Mike Cooper" <bi******@yahoo.com> wrote in message
news:8b**************************@posting.google.c om...
I have been staring at the above error for over a week now! I have a
an inherited data class looking like thus:

Public Class DataGridBoolColumnInherit
Inherits System.Windows.Forms.DataGridBoolColumn

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)

---------------------

Then in my Main() I have the following relevent code:

Friend WithEvents DataGridBoolColumnInherit1 As
DataGridBoolColumnInherit
Me.DataGridBoolColumnInherit1 = New DataGridBoolColumnInherit()

Public Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

Dim dgt As DataGridTableStyle = Main_DataGrid.TableStyles(0)

Dim cm As CurrencyManager = CType(Me.BindingContext _
(Main_DataSet.Tables(dgt.MappingName)), CurrencyManager)

Dim cellRect As Rectangle
Dim cellrow As Integer = 5
Dim cellcolumn As Integer = 1
cellRect = Main_DataGrid.GetCellBounds(3, 0)
hehe = dgt.GridColumnStyles(0)
Dim gridCol As MyGridColumn
Dim graph As Graphics = Main_DataGrid.CreateGraphics()
Dim fBrush As New SolidBrush(Color.Yellow)
Dim bBrush As New SolidBrush(Color.Yellow)
DataGridBoolColumnInherit1.Paint(graph, cellRect, cm, cellrow,
bBrush,
fbrush, False)
For some reason the program does not "see" the Paint method inherited
from datagridboolcolumn. This problem has "simple answer" written all
over it. But I don't see it! Can anyone else? Please?

Mike Cooper

Nov 20 '05 #3
Mike,
Thank you for responding. I guess the large gaps in my knowledge of
visual basic are showing. Can you elaborate? I had assumed that
objects of classes could be instantiated anywhere with full access to
there own defined methods. The object itself has full access to its methods, other objects have access
only to certain methods, based on the accessibility of the method, this
accessibility can be Public, Private, Protected, Protected Friend, and
Friend.

For details on Accessibility see:
http://msdn.microsoft.com/library/de...essibility.asp

For details on OOP, Encapsulation & how that fits with accessibility see:

http://msdn.microsoft.com/library/de...ithObjects.asp
How would a
button click color a cell if not through the datagrid's own paint
method?
The button should not 'color a cell', a button should tell the cell what
color to use, the cell then should paint itself, assuming of course the cell
is even visible. In other words the 'cell' should have a Color property,
when you set this color property it should Invalidate the window, so as to
have Windows raise the Paint event, in response to the Paint event the Cell
should paint itself the color it needs to be.

However! remember that the Cell in question is actually part of the DataGrid
control, which has its own ideas of how to paint cells...

I would recommend the following articles to properly create a custom data
grid column:

http://support.microsoft.com/default...en-us%3B318581

http://msdn.microsoft.com/library/de...stDataGrid.asp

A data grid column sample control can be found on this page (in the middle
or so).
http://www.windowsforms.net/Default....dex=3&tabid=49

A suite of Data Grid Column Styles you can purchase:
http://www.datagridcolumnstyles.net/default.asp

Hope this helps
Jay
"Mike Cooper" <bi******@yahoo.com> wrote in message
news:8b**************************@posting.google.c om... Hello Jay,

Thank you for responding. I guess the large gaps in my knowledge of
visual basic are showing. Can you elaborate? I had assumed that
objects of classes could be instantiated anywhere with full access to
there own defined methods. In my code in I created an object of my
datagridboolcolumninherit class, and tried to have it execute its
paint method. The humble purpose of the code I showed was to color a
certain datagrid cell whenever a button was pushed. How would a
button click color a cell if not through the datagrid's own paint
method?

Thank you,
Mike Cooper

<<snip>>
Nov 20 '05 #4

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

Similar topics

0
by: Eph0nk | last post by:
Hi, I get an overload resolution failed error (Overload resolution failed because no accessible 'New' can be called without a narrowing conversion), and I can't seem to find a lot of relevant...
5
by: Gang Zhang | last post by:
Hi, I have 2 overloaded functions as below: myfunc(byval val as Decimal) as string myfunc(byval val as String) as string When calling the function with a single like: dim num1 as single...
0
by: Cailin | last post by:
I am trying to make a connection with my SQL server DB, and I got this error message: "BC30519: Overload resolution failed because no accessible 'New' can be called without a narrowing...
1
by: steve | last post by:
I am trying to create an XSLT Transform but keep getting the same problem. Overload resolution failed because no accessible 'Transform' can be called with these arguments. I create a reference...
0
by: bcobra | last post by:
What am I doing wrong? the code: age Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" %> <%@ Register TagPrefix="MM" Namespace="DreamweaverCtrls"...
4
by: Kevin Burton | last post by:
I have a base (MustInherit/abstact) class that looks like: Public MustInherit Class BaseClass End Class Then I have three derived classes: Public Class DerivedA Inherits BaseClass End...
2
by: jason | last post by:
Since going to framework 2.0 from 1.1, I'm getting error: Overload resolution failed because no accessible 'New' can be called without a narrowing conversion: On line: Dim LogInfo As New...
1
by: =?Utf-8?B?QU1lcmNlcg==?= | last post by:
I have a strange situation with vb 2005 regarding option strict that looks like a compiler bug to me. Consider: Dim f1 As New Font("Arial", 8.25) Dim f2 As New Font("Arial", 8.25,...
2
by: Bart | last post by:
Hi, i get the error "BC30518:Overload resolution failed because no accessible 'Join' can be called with these arguments" at line: hvd = Join(hvertp, ",") Any idea what's wrong here? Thanks...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.