thatsthefactsjac
asked on
information lookup
I am creating a VB app with a procedure that looks up and returns data based on a value that is passed to it (like querying a record with the record ID). However, my app has no database functions and the data never changes. Is there a better way than using an if...Then or a Case statement?
For example:
Private Sub GetData(DataID As Integer, ByRef Data1 As String, ByRef Data2 As Boolean, Data3 As Integer)
Select Case DataID
Case 1
Data1 = "Hello World"
Data2 = True
Data3 = 32767
Case 2
...
End Select
End Sub
Thanks
For example:
Private Sub GetData(DataID As Integer, ByRef Data1 As String, ByRef Data2 As Boolean, Data3 As Integer)
Select Case DataID
Case 1
Data1 = "Hello World"
Data2 = True
Data3 = 32767
Case 2
...
End Select
End Sub
Thanks
If you want cleaner code store the data in an Access Database and run your query of that. That is a much better way.
ASKER
Maxim10553,
I know that an Access database would do the trick nicely, but I would prefer to keep my application as "slim" as possible. However, I may choose that route...
I know that an Access database would do the trick nicely, but I would prefer to keep my application as "slim" as possible. However, I may choose that route...
ASKER
Maxim10553,
I know that an Access database would do the trick nicely, but I would prefer to keep my application as "slim" as possible. However, I may choose that route...
I know that an Access database would do the trick nicely, but I would prefer to keep my application as "slim" as possible. However, I may choose that route...
ASKER
Maxim10553,
I know that an Access database would do the trick nicely, but I would prefer to keep my application as "slim" as possible. However, I may choose that route...
I know that an Access database would do the trick nicely, but I would prefer to keep my application as "slim" as possible. However, I may choose that route...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
A resource file will work well, thanks!
You're welcome! Glad to have helped.
By the way, Facts. Since you've stated taht the solution will work well, why did you penalize me by giving my a 'B' instead of an 'A'?
Why Not declared a user data type?:
Example:
Private Type myArray
DataID As Integer
Data1 As String
Data2 As Boolean
Data3 As Integer
End Type
Dim myData() As myArray
Private Sub Form_Load()
ReDim myData(1)
myData(0).DataID = 1
myData(0).Data1 = "Hello World"
myData(0).Data2 = True
myData(0).Data3 = 123
myData(0).DataID = 2
myData(0).Data1 = "EE"
myData(0).Data2 = False
myData(0).Data3 = 4567
End Sub