×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

What's equivalent in VB.NET for VFP's #DEFINE in/and .H file?

What's equivalent in VB.NET for VFP's #DEFINE in/and .H file?

What's equivalent in VB.NET for VFP's #DEFINE in/and .H file?

(OP)
Colleagues,

Being working in VFP for so long (1997-2019), and last time working in VB 13+ years ago, I cannot find if there is in VB.NET something similar to VFP's .H file with all those #DEFINE statements.
Essentially, I need to define an array in header/resource file, and #INCLUDE (or just include) this file into the project. This array is to be used to optimize the code in VB .NET by replacing excessive If-ElseIf-... with For-Next cycle.
AHWBGA!

Regards,

Ilya

RE: What's equivalent in VB.NET for VFP's #DEFINE in/and .H file?

Precompiler directives are very common in any language, and the file extension also usually is .h

But you gotta tell me how you define an array via #define in VFP, you define constants, the names of them get replaced with the values, essentially. In VB.NET this is made with the preprocessor directive #CONST instead of #Define. You write that as #CONST NAME='value', or #CONST Answer=42 instead of the #DEFINE syntax that does not have the = operator.

But I think you look for something else.

Bye, Olaf.

Olaf Doschke Software Engineering
https://www.doschke.name

RE: What's equivalent in VB.NET for VFP's #DEFINE in/and .H file?

(OP)
Hi Olaf,
"how you define an array via #define in VFP" - good question! smile
Do not remember exactly how, but I saw it in yet VFP3b, IMS. My then "partner in crime" (fellow P/A) had it in a program written in FPD2.5, transferred it to VFP3, and it worked.
But then again: I might remembered the idea, not the execution of that latter...
Anyway, thank you for your tip, colleague!
I wonder if VB .NET would take #CONST String [] Offices = {"CHI","ATL","TRR","HII","MLW"}...

Regards,

Ilya

RE: What's equivalent in VB.NET for VFP's #DEFINE in/and .H file?

I think you look for an Enumeration.

CODE

Public Enum Days
  Sunday
  Monday
  Tuesday
  Wednesday
  Thursday
  Friday
  Saturday
End Enum

Dim items As Array
items = System.Enum.GetValues(GetType(Days))
Dim item As String
For Each item In items
    MsgBox(item)
Next 

Bye, Olaf.

Olaf Doschke Software Engineering
https://www.doschke.name

RE: What's equivalent in VB.NET for VFP's #DEFINE in/and .H file?

(OP)
Enumeration... The thought occurred to me also, but got no traction (dunno why).
Thank you for setting me straight, colleague!

Regards,

Ilya

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close