473,657 Members | 2,727 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 DataGridBoolCol umnInherit
Inherits System.Windows. Forms.DataGridB oolColumn

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 DataGridBoolCol umnInherit1 As
DataGridBoolCol umnInherit
Me.DataGridBool ColumnInherit1 = New DataGridBoolCol umnInherit()

Public Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click

Dim dgt As DataGridTableSt yle = Main_DataGrid.T ableStyles(0)

Dim cm As CurrencyManager = CType(Me.Bindin gContext _
(Main_DataSet.T ables(dgt.Mappi ngName)), CurrencyManager )

Dim cellRect As Rectangle
Dim cellrow As Integer = 5
Dim cellcolumn As Integer = 1
cellRect = Main_DataGrid.G etCellBounds(3, 0)
hehe = dgt.GridColumnS tyles(0)
Dim gridCol As MyGridColumn
Dim graph As Graphics = Main_DataGrid.C reateGraphics()
Dim fBrush As New SolidBrush(Colo r.Yellow)
Dim bBrush As New SolidBrush(Colo r.Yellow)
DataGridBoolCol umnInherit1.Pai nt(graph, cellRect, cm, cellrow,
bBrush,
fbrush, False)
For some reason the program does not "see" the Paint method inherited
from datagridboolcol umn. 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 1972
Mike,
Protected Overloads Overrides Sub Paint(ByVal g As Graphics, ByVal The Paint method of DataGridBoolCol umn is Protected, this means that only
the DataGridBoolCol umn class or a class derived from it can use the method.

The Button1_Click is not a member of the DataGridBoolCol umn 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.goo gle.com... 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 DataGridBoolCol umnInherit
Inherits System.Windows. Forms.DataGridB oolColumn

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 DataGridBoolCol umnInherit1 As
DataGridBoolCol umnInherit
Me.DataGridBool ColumnInherit1 = New DataGridBoolCol umnInherit()

Public Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click

Dim dgt As DataGridTableSt yle = Main_DataGrid.T ableStyles(0)

Dim cm As CurrencyManager = CType(Me.Bindin gContext _
(Main_DataSet.T ables(dgt.Mappi ngName)), CurrencyManager )

Dim cellRect As Rectangle
Dim cellrow As Integer = 5
Dim cellcolumn As Integer = 1
cellRect = Main_DataGrid.G etCellBounds(3, 0)
hehe = dgt.GridColumnS tyles(0)
Dim gridCol As MyGridColumn
Dim graph As Graphics = Main_DataGrid.C reateGraphics()
Dim fBrush As New SolidBrush(Colo r.Yellow)
Dim bBrush As New SolidBrush(Colo r.Yellow)
DataGridBoolCol umnInherit1.Pai nt(graph, cellRect, cm, cellrow,
bBrush,
fbrush, False)
For some reason the program does not "see" the Paint method inherited
from datagridboolcol umn. 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
datagridboolcol umninherit 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********@ema il.msn.com> wrote in message news:<OX******* *******@TK2MSFT NGP10.phx.gbl>. ..
Mike,
Protected Overloads Overrides Sub Paint(ByVal g As Graphics, ByVal

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

The Button1_Click is not a member of the DataGridBoolCol umn 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.goo gle.com...
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 DataGridBoolCol umnInherit
Inherits System.Windows. Forms.DataGridB oolColumn

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 DataGridBoolCol umnInherit1 As
DataGridBoolCol umnInherit
Me.DataGridBool ColumnInherit1 = New DataGridBoolCol umnInherit()

Public Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click

Dim dgt As DataGridTableSt yle = Main_DataGrid.T ableStyles(0)

Dim cm As CurrencyManager = CType(Me.Bindin gContext _
(Main_DataSet.T ables(dgt.Mappi ngName)), CurrencyManager )

Dim cellRect As Rectangle
Dim cellrow As Integer = 5
Dim cellcolumn As Integer = 1
cellRect = Main_DataGrid.G etCellBounds(3, 0)
hehe = dgt.GridColumnS tyles(0)
Dim gridCol As MyGridColumn
Dim graph As Graphics = Main_DataGrid.C reateGraphics()
Dim fBrush As New SolidBrush(Colo r.Yellow)
Dim bBrush As New SolidBrush(Colo r.Yellow)
DataGridBoolCol umnInherit1.Pai nt(graph, cellRect, cm, cellrow,
bBrush,
fbrush, False)
For some reason the program does not "see" the Paint method inherited
from datagridboolcol umn. 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.goo gle.com... 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
datagridboolcol umninherit 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
2598
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 information by googling the web. Function GetFromXml(Id As String, Node As String) Dim NodeValue As String Dim xpathDoc As XPathDocument Dim xmlNav As XPathNavigator Dim xmlNI As XPathNodeIterator
5
7999
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
1652
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 conversion". Here is my code. sub Page_Load dim myConnection as New SqlConnection("Provider=sqloledb;Data Source=123456;Initial Catalog=someDB;User Id=23456;Password=somePw;") dim myCommand as SqlDataAdapter = New SqlDataAdapter("SELECT symbol_id,
1
4011
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 to System.Xml.dll Here is the code Imports System.Xml Imports System.Xml.Xsl.XslTransform
0
2365
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" Assembly="DreamweaverCtrls,version=1.0.0.0,publicKeyToken=836f606ede05d46a,culture=neutral" %> <MM:DataSet id="SSF2Pinky"
4
2699
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 Class
2
1924
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 FileStream("f:\xxx\xxx.log", FileShare.ReadWrite,FileAccess.Read)
1
3714
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, FontStyle.Bold) ' f1 is ok with option strict on or off ' f2 is ok with strict on, but with off I get an overload resolution failure The complete diagnostic is:
2
7849
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 bart
0
8306
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8825
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8503
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8605
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6164
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4152
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2726
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 we have to send another system
2
1955
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1615
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.