473,395 Members | 1,616 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,395 software developers and data experts.

Right$ doesn't work

Hi,

A project in VB6 recently worked without any problems but now it's
complaining when I try to use 'Right$'. In immediate mode, when I'm typing
'print left$("123456",2)' I get the correct result '12'. When I type 'print
right$("123456",2) I expect the result '56' but all I get is an error 'type
declaration does not match declared data type'. And I can't find that I have
tried to declare 'right'. Can anyone explain what can cause this problem?

/ Bo

Jul 17 '05 #1
8 10445
Bo Wisén wrote:
Hi,

A project in VB6 recently worked without any problems but now it's
complaining when I try to use 'Right$'. In immediate mode, when I'm typing
'print left$("123456",2)' I get the correct result '12'. When I type 'print
right$("123456",2) I expect the result '56' but all I get is an error 'type
declaration does not match declared data type'. And I can't find that I have
tried to declare 'right'. Can anyone explain what can cause this problem?


The problem may be that Right() is defined in another library referenced
in your project.

Try to use the full object path to the Right() function, like:
Print VBA.Strings.Right("123456", 2)

If you want to know where the other "Right" is defined, press F2 to open
the Object Browser and search for Right. It will show you all objects
where "Right" is defined.

--
Olof Lagerkvist
ICQ: 724451
Web page: http://here.is/olof

Jul 17 '05 #2

"Olof Lagerkvist" <no@email.address> skrev i meddelandet
news:YK*****************@newsb.telia.net...
: Bo Wisén wrote:
:
: > Hi,
: >
: > A project in VB6 recently worked without any problems but now it's
: > complaining when I try to use 'Right$'. In immediate mode, when I'm
typing
: > 'print left$("123456",2)' I get the correct result '12'. When I type
'print
: > right$("123456",2) I expect the result '56' but all I get is an error
'type
: > declaration does not match declared data type'. And I can't find that I
have
: > tried to declare 'right'. Can anyone explain what can cause this
problem?
:
: The problem may be that Right() is defined in another library referenced
: in your project.
:
: Try to use the full object path to the Right() function, like:
: Print VBA.Strings.Right("123456", 2)
:
: If you want to know where the other "Right" is defined, press F2 to open
: the Object Browser and search for Right. It will show you all objects
: where "Right" is defined.
:
: --
: Olof Lagerkvist
: ICQ: 724451
: Web page: http://here.is/olof
:
Jul 17 '05 #3

"Olof Lagerkvist" <no@email.address> skrev i meddelandet
news:YK*****************@newsb.telia.net...
: Bo Wisén wrote:
:
: > Hi,
: >
: > A project in VB6 recently worked without any problems but now it's
: > complaining when I try to use 'Right$'. In immediate mode, when I'm
typing
: > 'print left$("123456",2)' I get the correct result '12'. When I type
'print
: > right$("123456",2) I expect the result '56' but all I get is an error
'type
: > declaration does not match declared data type'. And I can't find that I
have
: > tried to declare 'right'. Can anyone explain what can cause this
problem?
:
: The problem may be that Right() is defined in another library referenced
: in your project.
:
: Try to use the full object path to the Right() function, like:
: Print VBA.Strings.Right("123456", 2)
:
: If you want to know where the other "Right" is defined, press F2 to open
: the Object Browser and search for Right. It will show you all objects
: where "Right" is defined.
:
: --
: Olof Lagerkvist
: ICQ: 724451
: Web page: http://here.is/olof

Thanks!

Writing 'Print VBA.Strings.Right("123456", 2)' works but looking in the
object browser 'left' is defined in the library 'Unknown3' but 'right' is
not defined at all! If I open a new project 'right' works. What could be
done?
/ Bo
Jul 17 '05 #4
Bo Wisén wrote:
"Olof Lagerkvist" <no@email.address> skrev i meddelandet
news:YK*****************@newsb.telia.net...
: Bo Wisén wrote:
:
: > Hi,
: >
: > A project in VB6 recently worked without any problems but now it's
: > complaining when I try to use 'Right$'. In immediate mode, when I'm
typing
: > 'print left$("123456",2)' I get the correct result '12'. When I type
'print
: > right$("123456",2) I expect the result '56' but all I get is an error
'type
: > declaration does not match declared data type'. And I can't find that I
have
: > tried to declare 'right'. Can anyone explain what can cause this
problem?
:
: The problem may be that Right() is defined in another library referenced
: in your project.
:
: Try to use the full object path to the Right() function, like:
: Print VBA.Strings.Right("123456", 2)
:
: If you want to know where the other "Right" is defined, press F2 to open
: the Object Browser and search for Right. It will show you all objects
: where "Right" is defined.

Thanks!

Writing 'Print VBA.Strings.Right("123456", 2)' works but looking in the
object browser 'left' is defined in the library 'Unknown3' but 'right' is
not defined at all! If I open a new project 'right' works. What could be
done?


Hmm... If VBA.Strings.Right() would not have worked either and you find
no definition of Right() in the object browser I would have suggested to
check if the VBA library is referenced correctly, but now when
VBA.Strings.Right() works I do not know really...

If you look in Project -> References in the project where Right() does
not work, is the same "Visual Basic For Applications" library referenced
there as it is in a new project? If not, select the same VBA library as
you get for new projects. (This could be a bit tricky, you may have to
edit the object references in the .vbp file manually.)

--
Olof Lagerkvist
ICQ: 724451
Web page: http://here.is/olof

Jul 17 '05 #5

"Bo Wisén" <bo*****@telia.com> wrote in message
news:GT*****************@newsb.telia.net...
|
| Writing 'Print VBA.Strings.Right("123456", 2)' works but looking in
the
| object browser 'left' is defined in the library 'Unknown3' but 'right'
is
| not defined at all! If I open a new project 'right' works. What could
be
| done?
| / Bo
|

I think you must have the object browser set to look only in the current
project, instead of "<All Libraries>" or "VBA". This is set in the drop
down list in the upper left corner of the browser.

With "<All Libraries>" selected, the Left property should be listed for
each of the standard VB controls, and you should also see it listed as a
VBA function. Right should be a VBA function listing as well. You may
then discover some other listing for Right, which is causing the
original problem.

Jul 17 '05 #6
Ensure that the first four selected (in order) items under
project>references are:

visual basic for applications
visual basic runtime objects and procedures
visual basic objects and procedures
OLE automation

If another control or class has defined a Right method, VB will require you
prefix with VBA.xxx in order to identify the particular Right method you
want to use. Ditto for the other control/classes Right method.

--
Randy Birch
MS MVP Visual Basic
http://vbnet.mvps.org/
"Bo Wisén" <bo*****@telia.com> wrote in message
news:GT*****************@newsb.telia.net...
:
: "Olof Lagerkvist" <no@email.address> skrev i meddelandet
: news:YK*****************@newsb.telia.net...
: : Bo Wisin wrote:
: :
: : > Hi,
: : >
: : > A project in VB6 recently worked without any problems but now it's
: : > complaining when I try to use 'Right$'. In immediate mode, when I'm
: typing
: : > 'print left$("123456",2)' I get the correct result '12'. When I type
: 'print
: : > right$("123456",2) I expect the result '56' but all I get is an error
: 'type
: : > declaration does not match declared data type'. And I can't find that
I
: have
: : > tried to declare 'right'. Can anyone explain what can cause this
: problem?
: :
: : The problem may be that Right() is defined in another library referenced
: : in your project.
: :
: : Try to use the full object path to the Right() function, like:
: : Print VBA.Strings.Right("123456", 2)
: :
: : If you want to know where the other "Right" is defined, press F2 to open
: : the Object Browser and search for Right. It will show you all objects
: : where "Right" is defined.
: :
: : --
: : Olof Lagerkvist
: : ICQ: 724451
: : Web page: http://here.is/olof
:
: Thanks!
:
: Writing 'Print VBA.Strings.Right("123456", 2)' works but looking in the
: object browser 'left' is defined in the library 'Unknown3' but 'right' is
: not defined at all! If I open a new project 'right' works. What could be
: done?
: / Bo
:
:

Jul 17 '05 #7
On Sun, 31 Oct 2004 10:19:44 GMT, "Bo Wisén" <bo*****@telia.com>
wrote:
Hi,

A project in VB6 recently worked without any problems but now it's
complaining when I try to use 'Right$'. In immediate mode, when I'm typing
'print left$("123456",2)' I get the correct result '12'. When I type 'print
right$("123456",2) I expect the result '56' but all I get is an error 'type
declaration does not match declared data type'. And I can't find that I have
tried to declare 'right'. Can anyone explain what can cause this problem?


Stick the cursor on the rogue 'Right' and press Shift F2
- see where the 'declaration tracer' takes you
Jul 17 '05 #8
>>A project in VB6 recently worked without any problems but now it's
complaining when I try to use 'Right$'. In immediate mode, when I'm
typing 'print left$("123456",2)' I get the correct result '12'. When I
type 'print right$("123456",2) I expect the result '56' but all I get
is an error 'type declaration does not match declared data type'. And
I can't find that I have tried to declare 'right'. Can anyone explain
what can cause this problem?


The "$" declares "right" to be a string. Immediate mode is funny about how
you declare variables with a suffix. It keeps its own table of variables
and won't let you change it. Try "right" without the "$", which makes it a
variant and might undeclare it. The "2" might be a conflict, too.

Jul 17 '05 #9

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

Similar topics

8
by: Warren Post | last post by:
Here's a problem I've never seen before. On <http://snow.prohosting.com/srcopan/anti/>, should the viewport width be less than the width of the page's header, then the right margin becomes stuck...
0
by: David Lindgren | last post by:
Hello! I am using a thirdparty gridcontrol which has a bug in it. It consists of that when setting a column to be right aligned it doesn't work as it should. The column gets rightaligned, but...
6
by: tshad | last post by:
I have a cell with 2 items in it: a textbox and a link. The link is actually a button (image), but for the example I am using a link, which is doing the same thing. Here is the stripped down...
161
by: Dan Lenski | last post by:
Hi all, I'm a recent, belated convert from Perl. I work in a physics lab and have been using Python to automate a lot of measurement equipment lately. It works fabulously for this purpose. ...
5
by: tshad | last post by:
I have a datagrid that I cannot get to right justify a money amount (which is just a label). No matter what I do - it still right justifies it. <asp:TemplateColumn Visible="true"...
8
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I disable the right mouse button? -----------------------------------------------------------------------...
2
by: Berlin Brown | last post by:
This is a simple div/layout question. I could easily solve the problem with a table, but I don't want to do that. I have a row of links. I want row 1 to have links and row 2 to have links. I...
7
by: vulpes | last post by:
Hi, I have a horizontal css list and I'd like its last item to be aligned to the right end of the space given to the list. I can separate it from the rest with margin-left: 10em, but that's...
0
by: Egor Zindy | last post by:
Egor Zindy wrote: #!/usr/bin/env python """ A generic chipid library based on ctypes This module handles most of the functions in FTChipID.dll
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.