Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Questions & Help Needed
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Questions & Help Needed Post any question regarding Basic4ppc.


Custom function


Closed Thread
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-08-2008, 03:16 PM
Banned
 
Join Date: Mar 2008
Posts: 5
Default Custom function

Hi,

Is there a way to create a custom function, like in Excel VBA ?
For example a function to multiply two numbers,

=multiply(a,b)

where a and b are 2 text boxes on a form.

If anyone can give me an example, I will understand better and try to create my own functions.

Thanks!

Last edited by go4saint : 04-08-2008 at 03:18 PM.
  #2 (permalink)  
Old 04-08-2008, 03:51 PM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Switzerland
Posts: 707
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default

Yes you can !

I have added a small example that shows a solution.

Code:
Sub Globals
'Declare the global variables here.
	c=0
End Sub

Sub App_Start
	Form1.Show
End Sub

Sub Multiply(a,b)
	Return a*b
End Sub

Sub Button1_Click
	c=Multiply(TextBox1.Text,TextBox2.Text)
	Label1.Text=c
End Sub
You can of course use other intermediate variables for the values in the textboxes.

Best regards
Attached Files
File Type: sbp TestFunction.sbp (741 Bytes, 5 views)
__________________
Klaus
Switzerland
  #3 (permalink)  
Old 04-08-2008, 04:11 PM
Banned
 
Join Date: Mar 2008
Posts: 5
Default

Thanks a lot!
  #4 (permalink)  
Old 04-08-2008, 08:06 PM
Banned
 
Join Date: Mar 2008
Posts: 5
Default

Thanks for solution klaus,

but there is a problem when I try to compile in both Desktop and Device.

Error Message CS1525:Invalid expression term ')'
in line c=Multiply(TextBox1.Text,TextBox2.Text)
  #5 (permalink)  
Old 04-08-2008, 08:19 PM
specci48's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: Germany
Posts: 650
Default

Hm... there must be a typo or something like that in your personal code because the sample of klaus works fine. Take his attachment and try to compile it, it will work. So I'm sure you implemented his solution manually into your own code.

Error CS1525 occurs when the compiler detects an invalid character in an expression, so have a close look to you code again.


specci48
  #6 (permalink)  
Old 04-08-2008, 08:24 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,199
Default

Thats because you are using a hacked version of Basic4ppc.
Closed Thread



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom contact list Dinis Questions & Help Needed 9 08-31-2008 12:18 PM
Function Key eillezcas Questions & Help Needed 0 08-27-2008 09:28 PM
Exp() function Bruno Questions & Help Needed 5 06-05-2008 08:03 PM
C# Custom control creation Cableguy Questions & Help Needed 2 05-19-2008 02:04 PM
QuickSMS - Define your own custom speed send messages and send them quickly! Oran Share Your Creations 2 02-17-2008 07:30 AM


All times are GMT. The time now is 01:35 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0