By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,333 Members | 1,022 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,333 IT Pros & Developers. It's quick & easy.

no accessible 'DrawText' is most specific

P: n/a
DF
DrawText is overloaded - one of which accepts a ByVal rect and the other accepts a ByRef rect. I get a "no accessible 'DrawText' is most specific" error. How can I resolve this problem by forcing VB to recognize the one I want?

Any help would be greatly appreciated.

DF

Nov 21 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
DF,
You cannot override a method based on ByRef & ByVal, you will get a compile
error on one of the methods themselves. Primarily because VB.NET does not
have a construct to specify which one to use.

Where & How is DrawText defined that you managed to get both ByRef & ByVal
overloads?

Hope this helps
Jay

"DF" <MA***********@comcast.netNOSPAM> wrote in message
news:u6**************@tk2msftngp13.phx.gbl...
DrawText is overloaded - one of which accepts a ByVal rect and the other
accepts a ByRef rect. I get a "no accessible 'DrawText' is most specific"
error. How can I resolve this problem by forcing VB to recognize the one I
want?

Any help would be greatly appreciated.

DF
Nov 21 '05 #2

P: n/a
DF
Hi Jay,

This is the code:

batchSprite.Begin(DX3D.SpriteFlags.AlphaBlend Or _

DX3D.SpriteFlags.SortTexture)

Dim rect As New System.Drawing.Rectangle(5, 5, 0, 0)

viewFont.DrawText(batchSprite, _

Convert.ToString(Val), _

rect, _

DX3D.DrawTextFormat.NoClip, _

System.Drawing.Color.Yellow)

batchSprite.End()

I'm using Visual Studio 2003. The viewFont.DrawText code above has the blue
squiggly lines underneath. When I mouseover it, I get a yellow box that
basically says "overload resolution failed. No accessible

'DrawText' is most specific." message. There are two options in the box. One
contains a ByRef rect and the other ByVal rect. Since I can't figure out how
to tell VB which one to use, I can't compile the code.

Any advice?

Thanks for you time,

DF

"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:#B*************@TK2MSFTNGP11.phx.gbl...
DF,
You cannot override a method based on ByRef & ByVal, you will get a compile error on one of the methods themselves. Primarily because VB.NET does not
have a construct to specify which one to use.

Where & How is DrawText defined that you managed to get both ByRef & ByVal
overloads?

Hope this helps
Jay

"DF" <MA***********@comcast.netNOSPAM> wrote in message
news:u6**************@tk2msftngp13.phx.gbl...
DrawText is overloaded - one of which accepts a ByVal rect and the other
accepts a ByRef rect. I get a "no accessible 'DrawText' is most specific"
error. How can I resolve this problem by forcing VB to recognize the one I
want?

Any help would be greatly appreciated.

DF

Nov 21 '05 #3

P: n/a
DF,
What type of object is viewFont (its Dim statement)?

As I stated, VB.NET does not allow you to define them, nor use them (if C#,
C++ or other language happens to define them!).

The reason VB.NET does not support them is they are not CLS compliant (as
you are finding out).

Hope this helps
Jay
"DF" <MA***********@comcast.netNOSPAM> wrote in message
news:e3*************@TK2MSFTNGP11.phx.gbl...
Hi Jay,

This is the code:

batchSprite.Begin(DX3D.SpriteFlags.AlphaBlend Or _

DX3D.SpriteFlags.SortTexture)

Dim rect As New System.Drawing.Rectangle(5, 5, 0, 0)

viewFont.DrawText(batchSprite, _

Convert.ToString(Val), _

rect, _

DX3D.DrawTextFormat.NoClip, _

System.Drawing.Color.Yellow)

batchSprite.End()

I'm using Visual Studio 2003. The viewFont.DrawText code above has the blue squiggly lines underneath. When I mouseover it, I get a yellow box that
basically says "overload resolution failed. No accessible

'DrawText' is most specific." message. There are two options in the box. One contains a ByRef rect and the other ByVal rect. Since I can't figure out how to tell VB which one to use, I can't compile the code.

Any advice?

Thanks for you time,

DF

"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:#B*************@TK2MSFTNGP11.phx.gbl...
DF,
You cannot override a method based on ByRef & ByVal, you will get a

compile
error on one of the methods themselves. Primarily because VB.NET does not have a construct to specify which one to use.

Where & How is DrawText defined that you managed to get both ByRef & ByVal overloads?

Hope this helps
Jay

"DF" <MA***********@comcast.netNOSPAM> wrote in message
news:u6**************@tk2msftngp13.phx.gbl...
DrawText is overloaded - one of which accepts a ByVal rect and the other
accepts a ByRef rect. I get a "no accessible 'DrawText' is most specific" error. How can I resolve this problem by forcing VB to recognize the one I want?

Any help would be greatly appreciated.

DF


Nov 21 '05 #4

P: n/a
DF
import microsoft.directx as dx
import microsoft.directx.direct3d as dx3d

dim viewFont as DX.Font

viewFont = new DX.Font (device, Arial, 12 point) <-- can't remember exact
syntax

-------------------------------
from MSDN (the 5th and 6th ones are the problem)
http://msdn.microsoft.com/library/de...us/directx9_m/
directx/ref/ns/microsoft.directx.direct3d/c/font/m/drawtext.asp
---------------------------------

Note: This documentation is preliminary and is subject to change.
Draws formatted text.

Overload List

public int DrawText(Sprite, string, int, int, Color);
public int DrawText(Sprite, string, int, int, int);
public int DrawText(Sprite, string, Point, Color);
public int DrawText(Sprite, string, Point, int);
public int DrawText(Sprite, string, ref Rectangle, DrawTextFormat,
Color);
public int DrawText(Sprite, string, Rectangle, DrawTextFormat,
Color);
public int DrawText(Sprite, string, ref Rectangle, DrawTextFormat,
int);
public int DrawText(Sprite, string, Rectangle, DrawTextFormat, int);

Remarks

This method must be called from inside of a Device.BeginScene ...
Device.EndScene block.

Unless the NoClip format is used, this method clips the text so that it
does not appear outside of the specified rectangle. All formatting is
assumed to have multiple lines unless the SingleLine format is specified.

If the selected font is too large for the rectangle, this method does not
attempt to substitute a smaller font.

This method supports only fonts whose escapement and orientation are both
zero.
----------------------------------------------------------------------------
----

"Jay B. Harlow [MVP - Outlo
ok]" <Ja************@msn.com> wrote in message
news:#3*************@TK2MSFTNGP10.phx.gbl...
DF,
What type of object is viewFont (its Dim statement)?

As I stated, VB.NET does not allow you to define them, nor use them (if C#, C++ or other language happens to define them!).

The reason VB.NET does not support them is they are not CLS compliant (as
you are finding out).

Hope this helps
Jay
"DF" <MA***********@comcast.netNOSPAM> wrote in message
news:e3*************@TK2MSFTNGP11.phx.gbl...
Hi Jay,

This is the code:

batchSprite.Begin(DX3D.SpriteFlags.AlphaBlend Or _

DX3D.SpriteFlags.SortTexture)

Dim rect As New System.Drawing.Rectangle(5, 5, 0, 0)

viewFont.DrawText(batchSprite, _

Convert.ToString(Val), _

rect, _

DX3D.DrawTextFormat.NoClip, _

System.Drawing.Color.Yellow)

batchSprite.End()

I'm using Visual Studio 2003. The viewFont.DrawText code above has the blue
squiggly lines underneath. When I mouseover it, I get a yellow box that
basically says "overload resolution failed. No accessible

'DrawText' is most specific." message. There are two options in the box.

One
contains a ByRef rect and the other ByVal rect. Since I can't figure out

how
to tell VB which one to use, I can't compile the code.

Any advice?

Thanks for you time,

DF

"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:#B*************@TK2MSFTNGP11.phx.gbl...
DF,
You cannot override a method based on ByRef & ByVal, you will get a

compile
error on one of the methods themselves. Primarily because VB.NET does

not have a construct to specify which one to use.

Where & How is DrawText defined that you managed to get both ByRef & ByVal overloads?

Hope this helps
Jay

"DF" <MA***********@comcast.netNOSPAM> wrote in message
news:u6**************@tk2msftngp13.phx.gbl...
DrawText is overloaded - one of which accepts a ByVal rect and the other accepts a ByRef rect. I get a "no accessible 'DrawText' is most specific" error. How can I resolve this problem by forcing VB to recognize the
one I want?

Any help would be greatly appreciated.

DF



Nov 21 '05 #5

P: n/a
DF,
I'll do some checking.

Short answer, you cannot use those overloads in VB.NET.

Your choices are:
- Use C#
- Use one of the other overloads that are not overloaded on ByVal & ByRef.

Hope this helps
Jay

"DF" <MA***********@comcast.netNOSPAM> wrote in message
news:eo*************@tk2msftngp13.phx.gbl...
import microsoft.directx as dx
import microsoft.directx.direct3d as dx3d

dim viewFont as DX.Font

viewFont = new DX.Font (device, Arial, 12 point) <-- can't remember exact
syntax

-------------------------------
from MSDN (the 5th and 6th ones are the problem)
http://msdn.microsoft.com/library/de...us/directx9_m/ directx/ref/ns/microsoft.directx.direct3d/c/font/m/drawtext.asp
---------------------------------

Note: This documentation is preliminary and is subject to change.
Draws formatted text.

Overload List

public int DrawText(Sprite, string, int, int, Color);
public int DrawText(Sprite, string, int, int, int);
public int DrawText(Sprite, string, Point, Color);
public int DrawText(Sprite, string, Point, int);
public int DrawText(Sprite, string, ref Rectangle, DrawTextFormat,
Color);
public int DrawText(Sprite, string, Rectangle, DrawTextFormat,
Color);
public int DrawText(Sprite, string, ref Rectangle, DrawTextFormat,
int);
public int DrawText(Sprite, string, Rectangle, DrawTextFormat, int);
Remarks

This method must be called from inside of a Device.BeginScene ...
Device.EndScene block.

Unless the NoClip format is used, this method clips the text so that it
does not appear outside of the specified rectangle. All formatting is
assumed to have multiple lines unless the SingleLine format is specified.

If the selected font is too large for the rectangle, this method does not attempt to substitute a smaller font.

This method supports only fonts whose escapement and orientation are both zero.
-------------------------------------------------------------------------- -- ----

"Jay B. Harlow [MVP - Outlo
ok]" <Ja************@msn.com> wrote in message
news:#3*************@TK2MSFTNGP10.phx.gbl...
DF,
What type of object is viewFont (its Dim statement)?

As I stated, VB.NET does not allow you to define them, nor use them (if

C#,
C++ or other language happens to define them!).

The reason VB.NET does not support them is they are not CLS compliant (as
you are finding out).

Hope this helps
Jay
"DF" <MA***********@comcast.netNOSPAM> wrote in message
news:e3*************@TK2MSFTNGP11.phx.gbl...
Hi Jay,

This is the code:

batchSprite.Begin(DX3D.SpriteFlags.AlphaBlend Or _

DX3D.SpriteFlags.SortTexture)

Dim rect As New System.Drawing.Rectangle(5, 5, 0, 0)

viewFont.DrawText(batchSprite, _

Convert.ToString(Val), _

rect, _

DX3D.DrawTextFormat.NoClip, _

System.Drawing.Color.Yellow)

batchSprite.End()

I'm using Visual Studio 2003. The viewFont.DrawText code above has the

blue
squiggly lines underneath. When I mouseover it, I get a yellow box that basically says "overload resolution failed. No accessible

'DrawText' is most specific." message. There are two options in the
box. One
contains a ByRef rect and the other ByVal rect. Since I can't figure
out how
to tell VB which one to use, I can't compile the code.

Any advice?

Thanks for you time,

DF

"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message news:#B*************@TK2MSFTNGP11.phx.gbl...
> DF,
> You cannot override a method based on ByRef & ByVal, you will get a
compile
> error on one of the methods themselves. Primarily because VB.NET
does not
> have a construct to specify which one to use.
>
> Where & How is DrawText defined that you managed to get both ByRef &

ByVal
> overloads?
>
> Hope this helps
> Jay
>
>
>
> "DF" <MA***********@comcast.netNOSPAM> wrote in message
> news:u6**************@tk2msftngp13.phx.gbl...
> DrawText is overloaded - one of which accepts a ByVal rect and the

other > accepts a ByRef rect. I get a "no accessible 'DrawText' is most

specific"
> error. How can I resolve this problem by forcing VB to recognize the

one
I
> want?
>
> Any help would be greatly appreciated.
>
> DF
>
>



Nov 21 '05 #6

P: n/a
DF,
I'm still checking, I just wanted to add:

Long answer, you cannot use those overloads in VB.NET, as the CLS (Common
Language System) which VB.NET adhers to, does not allow overloading on ByVal
& ByRef, as its ambiguous in languages that do not require ByRef (ref in C#)
on the method calls themselves. VB.NET only allows ByRef on the method
declaration.

I'll do some more checking if there is an alternative within VB.NET that you
can use, or you will have to use C#.

Hope this helps
Jay
"DF" <MA***********@comcast.netNOSPAM> wrote in message
news:eo*************@tk2msftngp13.phx.gbl...
import microsoft.directx as dx
import microsoft.directx.direct3d as dx3d

dim viewFont as DX.Font

viewFont = new DX.Font (device, Arial, 12 point) <-- can't remember exact
syntax

-------------------------------
from MSDN (the 5th and 6th ones are the problem)
http://msdn.microsoft.com/library/de...us/directx9_m/ directx/ref/ns/microsoft.directx.direct3d/c/font/m/drawtext.asp
---------------------------------

Note: This documentation is preliminary and is subject to change.
Draws formatted text.

Overload List

public int DrawText(Sprite, string, int, int, Color);
public int DrawText(Sprite, string, int, int, int);
public int DrawText(Sprite, string, Point, Color);
public int DrawText(Sprite, string, Point, int);
public int DrawText(Sprite, string, ref Rectangle, DrawTextFormat,
Color);
public int DrawText(Sprite, string, Rectangle, DrawTextFormat,
Color);
public int DrawText(Sprite, string, ref Rectangle, DrawTextFormat,
int);
public int DrawText(Sprite, string, Rectangle, DrawTextFormat, int);
Remarks

This method must be called from inside of a Device.BeginScene ...
Device.EndScene block.

Unless the NoClip format is used, this method clips the text so that it
does not appear outside of the specified rectangle. All formatting is
assumed to have multiple lines unless the SingleLine format is specified.

If the selected font is too large for the rectangle, this method does not attempt to substitute a smaller font.

This method supports only fonts whose escapement and orientation are both zero.
-------------------------------------------------------------------------- -- ----

"Jay B. Harlow [MVP - Outlo
ok]" <Ja************@msn.com> wrote in message
news:#3*************@TK2MSFTNGP10.phx.gbl...
DF,
What type of object is viewFont (its Dim statement)?

As I stated, VB.NET does not allow you to define them, nor use them (if

C#,
C++ or other language happens to define them!).

The reason VB.NET does not support them is they are not CLS compliant (as
you are finding out).

Hope this helps
Jay
"DF" <MA***********@comcast.netNOSPAM> wrote in message
news:e3*************@TK2MSFTNGP11.phx.gbl...
Hi Jay,

This is the code:

batchSprite.Begin(DX3D.SpriteFlags.AlphaBlend Or _

DX3D.SpriteFlags.SortTexture)

Dim rect As New System.Drawing.Rectangle(5, 5, 0, 0)

viewFont.DrawText(batchSprite, _

Convert.ToString(Val), _

rect, _

DX3D.DrawTextFormat.NoClip, _

System.Drawing.Color.Yellow)

batchSprite.End()

I'm using Visual Studio 2003. The viewFont.DrawText code above has the

blue
squiggly lines underneath. When I mouseover it, I get a yellow box that basically says "overload resolution failed. No accessible

'DrawText' is most specific." message. There are two options in the
box. One
contains a ByRef rect and the other ByVal rect. Since I can't figure
out how
to tell VB which one to use, I can't compile the code.

Any advice?

Thanks for you time,

DF

"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message news:#B*************@TK2MSFTNGP11.phx.gbl...
> DF,
> You cannot override a method based on ByRef & ByVal, you will get a
compile
> error on one of the methods themselves. Primarily because VB.NET
does not
> have a construct to specify which one to use.
>
> Where & How is DrawText defined that you managed to get both ByRef &

ByVal
> overloads?
>
> Hope this helps
> Jay
>
>
>
> "DF" <MA***********@comcast.netNOSPAM> wrote in message
> news:u6**************@tk2msftngp13.phx.gbl...
> DrawText is overloaded - one of which accepts a ByVal rect and the

other > accepts a ByRef rect. I get a "no accessible 'DrawText' is most

specific"
> error. How can I resolve this problem by forcing VB to recognize the

one
I
> want?
>
> Any help would be greatly appreciated.
>
> DF
>
>



Nov 21 '05 #7

P: n/a
DF
Thanks Jay.

I ended up using the one with the x and y and no DrawTextFormat.

Thanks so much for taking the time.

D
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:#i*************@TK2MSFTNGP12.phx.gbl...
DF,
I'll do some checking.

Short answer, you cannot use those overloads in VB.NET.

Your choices are:
- Use C#
- Use one of the other overloads that are not overloaded on ByVal & ByRef.

Hope this helps
Jay

"DF" <MA***********@comcast.netNOSPAM> wrote in message
news:eo*************@tk2msftngp13.phx.gbl...
import microsoft.directx as dx
import microsoft.directx.direct3d as dx3d

dim viewFont as DX.Font

viewFont = new DX.Font (device, Arial, 12 point) <-- can't remember exact
syntax

-------------------------------
from MSDN (the 5th and 6th ones are the problem)

http://msdn.microsoft.com/library/de...us/directx9_m/
directx/ref/ns/microsoft.directx.direct3d/c/font/m/drawtext.asp
---------------------------------

Note: This documentation is preliminary and is subject to change.
Draws formatted text.

Overload List

public int DrawText(Sprite, string, int, int, Color);
public int DrawText(Sprite, string, int, int, int);
public int DrawText(Sprite, string, Point, Color);
public int DrawText(Sprite, string, Point, int);
public int DrawText(Sprite, string, ref Rectangle, DrawTextFormat, Color);
public int DrawText(Sprite, string, Rectangle, DrawTextFormat,
Color);
public int DrawText(Sprite, string, ref Rectangle, DrawTextFormat, int);
public int DrawText(Sprite, string, Rectangle, DrawTextFormat,

int);

Remarks

This method must be called from inside of a Device.BeginScene ...
Device.EndScene block.

Unless the NoClip format is used, this method clips the text so that it does not appear outside of the specified rectangle. All formatting is
assumed to have multiple lines unless the SingleLine format is specified.
If the selected font is too large for the rectangle, this method does

not
attempt to substitute a smaller font.

This method supports only fonts whose escapement and orientation are

both
zero.


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

"Jay B. Harlow [MVP - Outlo
ok]" <Ja************@msn.com> wrote in message
news:#3*************@TK2MSFTNGP10.phx.gbl...
DF,
What type of object is viewFont (its Dim statement)?

As I stated, VB.NET does not allow you to define them, nor use them (if
C#,
C++ or other language happens to define them!).

The reason VB.NET does not support them is they are not CLS compliant (as you are finding out).

Hope this helps
Jay
"DF" <MA***********@comcast.netNOSPAM> wrote in message
news:e3*************@TK2MSFTNGP11.phx.gbl...
> Hi Jay,
>
> This is the code:
>
> batchSprite.Begin(DX3D.SpriteFlags.AlphaBlend Or _
>
> DX3D.SpriteFlags.SortTexture)
>
> Dim rect As New System.Drawing.Rectangle(5, 5, 0, 0)
>
> viewFont.DrawText(batchSprite, _
>
> Convert.ToString(Val), _
>
> rect, _
>
> DX3D.DrawTextFormat.NoClip, _
>
> System.Drawing.Color.Yellow)
>
> batchSprite.End()
>
> I'm using Visual Studio 2003. The viewFont.DrawText code above has
the blue
> squiggly lines underneath. When I mouseover it, I get a yellow box

that > basically says "overload resolution failed. No accessible
>
> 'DrawText' is most specific." message. There are two options in the box. One
> contains a ByRef rect and the other ByVal rect. Since I can't figure out how
> to tell VB which one to use, I can't compile the code.
>
> Any advice?
>
> Thanks for you time,
>
> DF
>
>
>
> "Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in

message
> news:#B*************@TK2MSFTNGP11.phx.gbl...
> > DF,
> > You cannot override a method based on ByRef & ByVal, you will get a > compile
> > error on one of the methods themselves. Primarily because VB.NET does not
> > have a construct to specify which one to use.
> >
> > Where & How is DrawText defined that you managed to get both ByRef & ByVal
> > overloads?
> >
> > Hope this helps
> > Jay
> >
> >
> >
> > "DF" <MA***********@comcast.netNOSPAM> wrote in message
> > news:u6**************@tk2msftngp13.phx.gbl...
> > DrawText is overloaded - one of which accepts a ByVal rect and the

other
> > accepts a ByRef rect. I get a "no accessible 'DrawText' is most
specific"
> > error. How can I resolve this problem by forcing VB to recognize

the one
I
> > want?
> >
> > Any help would be greatly appreciated.
> >
> > DF
> >
> >
>
>



Nov 21 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.