By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,057 Members | 1,407 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,057 IT Pros & Developers. It's quick & easy.

i got stuck!

P: 6
hello ..
how can I determine the type of triangle through its sides and angles ?
i have problems in understanding how functions are being created and used ;/
plz help me
thanks alot in advance
Nov 14 '06 #1
Share this Question
Share on Google+
7 Replies


Expert 5K+
P: 8,434
hello ..
how can I determine the type of triangle through its sides and angles ?
i have problems in understanding how functions are being created and used ;/
plz help me
thanks alot in advance
Well, once you create a function using the PUBLIC FUNCTION or PRIVATE FUNCTION statement, you can then use it just like the built-in functions (such as Mid$() and so on).

Say you want to pass the lengths of three sides as integers and return a decimal value calculated somehow. You'd probably define your function in a code module. Here's a simple example.
Expand|Select|Wrap|Line Numbers
  1. Public Function MyFunction(Parm1 As Long, Parm2 As Long, Parms3 As Long) As Single
  2.  
  3.   ' Do your calculation here, based on the values of
  4.   ' Parm1, Parm2 and Parm3.
  5.  
  6.   ' Return your value by assigning it to the
  7.   ' variable name "MyFunction".
  8.   ' For example...
  9.   MyFunction = Parm1 * Parm2 / Parm3
  10.  
  11. End Function
  12.  
You can then use this anywhere in your code, like so...
Expand|Select|Wrap|Line Numbers
  1. Var1 = MyFunction(Var2, Var3, Var4)
Nov 14 '06 #2

P: 6
thank you:)
I have a problem,

In the 1st txtbox when i enter a value, and then press enter the value will be cleared and cursor is moved to the other box, and this doesn't happen in other txtboxes..
what might be the reasons behind that ?
Nov 16 '06 #3

P: 5
thank you:)
I have a problem,

In the 1st txtbox when i enter a value, and then press enter the value will be cleared and cursor is moved to the other box, and this doesn't happen in other txtboxes..
what might be the reasons behind that ?
How does the cursor move to the other box when you press Enter? This is not the default behaviour in Windows applications, so maybe you have coded something in one of the events of the first text box?

Chandra
Nov 17 '06 #4

sivadhas2006
100+
P: 142
Hi,

Can you paste your code?
It may be useful for finding the problem.

Regards,
M.Sivadhas.
Nov 17 '06 #5

Expert 5K+
P: 8,434
Hi,
Can you paste your code?
It may be useful for finding the problem.
Regards,
Sivadhas.
It might also be helpful if you fill in some more detail on the environment. For example, is this Visual Basic (standalone) - if so, which version? Is it VBA? In Access? Excel? Word?
Nov 17 '06 #6

P: 6
thanks for trying to help me.. :)
for my good luck my problem was fixed .. till now i dont know how I did it, something related to the event itself, maybe,,
well, I'm using vb.net 2005

I have another question,
I created a msgbox, but when i start debugging the program,,,
at a certain event the msgbox appears, then i click on the OK button in it to let it disappear , but still it doesn't , As if it was freezed!
so I removed it from my program.

thank u :)
Nov 17 '06 #7

Expert 5K+
P: 8,434
thanks for trying to help me.. :)
...
We're always happy to help.

However, I'm a VB6 programmer and not familiar with VB 2005. Others here may be able to help more with the message box problem. You could also try the .Net forum, to see whether they can help.
Nov 19 '06 #8

Post your reply

Sign in to post your reply or Sign up for a free account.