Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Help needed with Functions and user defined types

Author
Message
Legarto
20
Years of Service
User Offline
Joined: 6th Jul 2004
Location:
Posted: 14th Jul 2004 05:06 Edited at: 14th Jul 2004 05:13
Hi all,

I have just purchased Dark Basic Pro and I am having a few problems adjusting from my Visual Basic .Net way of doing things. I hope someone here can give me some advice.

One of the problems I have encountered is in trying to write a function that takes as it's arguments 2 user defined types and alters the state of one of them.

Firstly is there any way that a function can alter the value of an argument and have that alteration visible from outside the function? In VB this would be accomplished by passing a reference to the argument rather than a copy of it, and therefore anything done to the variable from within the function would be visible outside the function.

If this is not possible in DB Pro then I would like to be able to have my function return the updated user defined type,so can anyone explain why the following doesn't work and fails during compilation with the error 'Both user defined type values must use the same type'



I hope I have explained this in a way that makes sense to all you DB Pro gurus out there and I hope you can help. I have to say that I am finding my first few days of programming with DB Pro terribly frustrating; I was looking forward to getting to grips with 3D graphics but I seem to be spending all my coding time working around the inadequacies of the basic syntax.

Does anyone know of a good book for someone who is experineced in programming but new to DB pro?

Thanks for taking the time to read this,

Regards,

Legarto.
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 14th Jul 2004 05:32 Edited at: 14th Jul 2004 05:45
Hello fellow .NETian

-You cannot pass udt's into a dbp function.
-there is no ByRef in dbp, define a global variable
Global strMyVar as String

-concerning your snippet, again no udts in functions as args

You can however, make a Type into a Type array which are global by default, then you could act on a udt from within a function. It's not ideal but you can do it

Also, if you are missing some of the "comforts of home" we have a free plugin for dbpro written in VB.NET, exposing many useful .net functions as well as some other goodies that .net programmers using dbp would most likely want. Click the image below and have a look, if you like.

here's a quick function list:



DBP_NETLIB_v1.4.3 - 65 FREE Functions * Click Logo
Legarto
20
Years of Service
User Offline
Joined: 6th Jul 2004
Location:
Posted: 14th Jul 2004 06:11
Hi CattleRustler,

thanks for the info, although it's not good news.

Your plugin should come in handy though, much appreciated.

Regards,

Legarto.
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 14th Jul 2004 06:58
no problem, good luck

regards
"Big Ol' Fat-Ass Bob the Cattle Rustler"


DBP_NETLIB_v1.4.3 - 65 FREE Functions * Click Logo

Login to post a reply

Server time is: 2024-09-22 16:28:19
Your offset time is: 2024-09-22 16:28:19