473,779 Members | 2,050 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 10478
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.Rig ht("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.addre ss> 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.Rig ht("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.addre ss> 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.Rig ht("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.Rig ht("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.addre ss> 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.Rig ht("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.Rig ht("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.Rig ht() 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.Rig ht() 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.Rig ht("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>referen ces 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.addre ss> 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.Rig ht("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.Rig ht("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
2594
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 at the viewport's right edge. This is perhaps better observed than described; try it yourself at narrow viewport widths and/or high zoom levels. I am guessing that I've mucked up something in the CSS's margin settings, but I can't find it by...
0
1604
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 only for text that has the same length. The longer the text in each cell is, the longer to the left the text is being printed. (Take a look at this file to see what it looks like: http://www.lowrad.net/files/grid_bug.jpg) I contacted the support...
6
1791
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 version of my page that shows the problem: *********************************************************************************** <html> <head></head>
161
5496
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. Recently I've wanted to start writing GUIs for some of my programs, for data visualization and to make the programs easier to use for some of my co-workers. So far I've experimented with two Python GUI toolkits: Tkinter and PyGTK. I've had some...
5
2704
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" itemStyle-Width="100px" HeaderText="Amount Per Job" HeaderStyle-Font-Bold="true" ItemStyle-VerticalAlign="middle" ItemStyle-HorizontalAlign="right" > <itemtemplate> <asp:Label ID="JobBoardPriceDisplay" style="text-align:right" runat="server"/> </itemtemplate>
8
3727
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I disable the right mouse button? ----------------------------------------------------------------------- The oncontextmenu intrinsic event is the only safe and reliable method. Of the other approaches often presented, most depend on an alert box interrupting the process and rarely work. Note that oncontextmenu is a non-standard event and is not...
2
4095
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 want both to align such they are on the right (edge up to the right). Here is my code or one variation of it. <div style="float: right; text-align: right;" id="row1">
7
7830
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 very error-prone (different resolutions) and just doesn't look that good. Using align: right doesn't work. Using float: right almost works.
0
2560
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
9633
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10137
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10074
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
9928
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...
0
8959
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6724
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5503
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4037
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
3632
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.