|
-
Oct 17th, 2006, 04:38 AM
#1
Thread Starter
Addicted Member
Using variable or Label
Hi guys,
I take data from Database and then display it using Label and/or Textbox.
Later i will doing some calculation from that data.
Please give me some advice for best approach to do calculation as i need.
Is it using Label/Textbox then convert it to appropriate DataType (Date, Long, Double, Integer, Etc) or best when i take data from DataBase i create variable separately (with appropriate DataType) for each Label/Textbox?
Sorry for my English 
Thanks.
Last edited by barianto; Oct 17th, 2006 at 04:46 AM.
-
Oct 17th, 2006, 06:04 AM
#2
Re: Using variable or Label
Six of one, half a dozen of another. Depending upon what you need to do with the data you can either use a variable you can set the Data Type when you dimensioned the variable or if you are displaying it you can just as easily change to the necessary data type (i.e, cLng, cStr, etc.)
Regards,
Mark
Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."
-
Oct 17th, 2006, 07:48 PM
#3
Thread Starter
Addicted Member
Re: Using variable or Label
Thanks Mark.
Any other point of view, people?
-
Oct 17th, 2006, 08:20 PM
#4
Re: Using variable or Label
It's better coding practice to store all data in variables (of the appropriate data type), and then display those variables in a label/textbox later.
This way you always have the data in its correct form in memory and you don't have to convert a label or textbox (string) back into the right data type.
-
Oct 17th, 2006, 08:40 PM
#5
Thread Starter
Addicted Member
Re: Using variable or Label
I have some thought like that too DigiRev.
But will it suffer (little bit or a lot) performance of our application if we have to many variable? Not to mention if we working with MDI form with no limitation for user to open the same Form.
-
Oct 17th, 2006, 08:48 PM
#6
Hyperactive Member
Re: Using variable or Label
Labels and textbox is just a controls you can use to display data from your database. Any calculation can be made using value from label or textbox but it is necessary to convert them into specific datatype using datatype conversion like cstr(), clng() and so on. You can also use data read directly from database by first storing them in variables with appropriate datatype for your calculation like what digirev suggested.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|