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 3 1915
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
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
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>> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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...
|
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...
|
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...
|
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"...
|
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...
|
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...
|
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,...
|
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...
|
by: Rina0 |
last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM)
The start time is equivalent to 19:00 (7PM) in Central...
|
by: erikbower65 |
last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps:
1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal.
2. Connect to...
|
by: linyimin |
last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
|
by: erikbower65 |
last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA:
1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
|
by: kcodez |
last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
|
by: Rina0 |
last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
|
by: DJRhino |
last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer)
If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _
310030356 Or 310030359 Or 310030362 Or...
|
by: DJRhino |
last post by:
Was curious if anyone else was having this same issue or not....
I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
| |