If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Corel Paradox > passing a string to a method

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-26-03, 14:38
waterstone waterstone is offline
Registered User
 
Join Date: Jan 2003
Posts: 3
passing a string to a method

I have a form level method:
method TakeString(var Hint string)
endmothod

I attempt to call it from a uiobjects mouseenter method like this

TakeString("Hello There")

I get the syntax error "parameter mismatch on the TakeString statement.

According to the help files, I can pass a string by value.

I know I can do the following

var Passit string endvar
Passit = "Hello There"
TakeString(Passit)But I'd really like to pass the literal.

I'm sure I'm missing something obvious.

TIA,
Waterstone
Reply With Quote
  #2 (permalink)  
Old 03-16-03, 21:38
TimS TimS is offline
Registered User
 
Join Date: Mar 2003
Location: Indiana, USA
Posts: 100
Just an guess but the word var means variable you are passing an constant. ( var means it can return an value; you can't return an value to an constant.)

Try using TakeString(String("Hello There"))
or removing the var in the method defination.

Tim S
Reply With Quote
  #3 (permalink)  
Old 03-17-03, 07:00
waterstone waterstone is offline
Registered User
 
Join Date: Jan 2003
Posts: 3
passing a string to a method

Tim,

Thanks for the suggestion. While the suggestion did not work because the called method cannot have a string literal as an argument, your post prompted me to use constants to define the values I wanted to pass, making the code much neater.

method ShowHints(const Hint String)

message(Hint)
HintText = Hint
HintBox.visible = true

endMethod

Then called it with predefined constants

ShowHint(Report01) where Report01 is a constant declared at the form level.

Thanks Again,
Stephen
Reply With Quote
  #4 (permalink)  
Old 08-27-03, 16:52
Shores Shores is offline
Registered User
 
Join Date: Aug 2003
Location: Bologna - Italy
Posts: 209
You can also simply remove "var":

method TakeString(Hint string)


Bye!
__________________
The only failure is not trying to do it.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On