Math.log Always Returns 0?
Jul 29, 2011
I've been having a problem with Math.Log in a function I'm trying to write. When working with variables, it always returns 0. Here's the line I'm trying to run:
Quote:
mb = txtMb.Text
k = txtK.Text
t = txtT.Text
[Code].....
View 5 Replies
ADVERTISEMENT
Mar 5, 2012
well i am having a couple of issues with this particular homework problem and this is my first programming class so there is probably quite a few mistakes well the homework problem is to take three double values entered by a user and display the largest and smallest using math.max and math.min and display the smallest and largest so i thought i could use a listbox and take the values that went to the listbox and assign variables to each so i can try to use each variable in the math.max and min but im not making it to far and i actually might be way off
[Code]...
View 4 Replies
Jun 24, 2010
I have some code which gets child items for a menu via the GetChildren function which takes a list of menuData: Dim builtMenu As New List(Of MenuData)(_rawData.FindAll(Function(item) item.GroupingID = 0))
For Each menuData As MenuData In builtMenu
If menuData.Children IsNot Nothing Then
menuData.Children.AddRange(GetChildren(menuData))
End If
Next
If I check if menudata.children isnot nothing, it always is nothing because the GetChildren function is yet to run (providing the child items, which do exist). If I remove this check and just have this code:
Dim builtMenu As New List(Of MenuData)(_rawData.FindAll(Function(item) item.GroupingID = 0))
For Each menuData As MenuData In builtMenu
menuData.Children.AddRange(GetChildren(menuData))
Next
Then I am presented with a Object reference not set to an instance of an object error on menuData.Children.AddRange(GetChildren(menuData))
View 1 Replies
Aug 20, 2009
I,m developing a debt calculation program 'my problem is when i have to calculate the months to pay back the debt it comes to 28.04 and i have to get it to 29 my code looks like this:
[Code]...
View 3 Replies
Mar 29, 2012
How can I round 4.39 to 5 in VB.NET? I tried:
Math.Round(4.39, 0)
But it displays 4.
View 1 Replies
Jan 27, 2012
I am trying to perform a simple multiplication in vb.
Below is my code:
Dim minus As Integer
Dim minusPrice As Integer
Dim totalPrice As Integer
[Code].....
View 4 Replies
May 8, 2009
I am trying to use Math.round. now my math.round (2.5) converting it to 2. O want to convert it to 3.
View 6 Replies
Apr 13, 2012
I am trying to do math (-, +, *, etc) based on what a user selects from a combo box. The combo has the operators (-, +, *, /) in its items list. when the user selects one of them, I want to use that operator with the two numbers the user also provides from two text boxes.
dim intNumOne as integer
dim intNumTwo as integer
dim intAnswer as integer
[Code]....
'I don't think I want to concatenate here. but this is what I would like to happen (use the operator based on the users selection from the combo and the two numbers from the text boxes. I know I could write a select case or If statement but is there a way to do what I'm trying to do without Select Case or If? I tried to make theOperator a 'char' type variable but that didn't work either.
View 3 Replies
Sep 20, 2009
Is there any way to parse a string in vb.net (like, built in methods), that can do math like Eval can? For example, 3+(7/3.5) as a string would return 2.
I am not asking for you to code this for me, I just want to know if there is a built in way to do this, if there is not I will code it myself.
I can wager that it would not be able to parse stuff like Sin(90) on its own, and I understand that would need to be replaced by Math.Sin(90).
View 5 Replies
Oct 29, 2009
I have tried following coding to get highest value.EX: If I type 4.341111111111, It should get the value 4.35. If I type 9.132222, It should be 9.14 not 9.13.[code]
View 9 Replies
Nov 24, 2010
I am building a tool to figure out final value fees. This is the math i have to try to code
$1,000.01 or more 8.75% of the initial $50.00, plus 4.0% of the next $50.01 - $1,000.00, plus 2.0% of the remaining final sale price balance ($1,000.01 - final sale price)
View 8 Replies
Jul 13, 2011
I'm using .Net 3.51 SP1. I've been having problems with .Net's inability to add single numbers, could anyone throw some light on this.
[Code]...
View 12 Replies
Jun 17, 2010
I am trying to create a small application which does mathematical calculations using dates and times. Specifically, to determine the period of time between two specific dates and times.
View 2 Replies
Mar 1, 2012
I have a strange result coming from some big math & have no clue as to why I'm getting a different answer from vb.net vs python.Here are the quick snippets & results:
VB.NET
Dim MSB As UInt32 = 3067297518
Dim LSB As UInt32 = 1439785590
[code]......
View 1 Replies
Feb 23, 2012
I've a problem using simple logarithm function Log in some ButtonClick Event. Log is underlined with next warning:System.Diagnostics.Log is not accessible in this context because it is Friend.
Have I missed something or this happens because of the Express version of Visual Basic?
View 1 Replies
Oct 17, 2009
1. The lens equation for a camera is 1/f=1/di+1/de , where f is the focal length of the lens, is the distance between the lens and the film, and is the distance between the lens and the object. For a certain camera, an object that is 18 cm from the lens is in focus when the lens is 9 cm from the film. What is the focal length of the lens?
View 1 Replies
Nov 27, 2010
Is there some interface I can implement to allow basic comparisons and math to happen as it would an integer?
For example, let's say I have the following class:
Public Class Something
Public SomeBigNumber as UInt64
End Class
I would like to do something like this:
Dim SomethingA, SomethingB, SomethingC as New Something
....
If (SomethingA-SomethingB) > SomethingC Then
'Do stuff
End If
I was hoping to be able to implement some interface (if that is even the right term for it) that would return the UInt64 contained in the class for comparison and math, if possible.
View 1 Replies
Apr 15, 2011
I have to use a round method that follows this behavior:
7.00 -> round -> 7
7.50 -> round -> 7
7.51 -> round -> 8
I tried to use Math.Round, but it works a little bit different.
[Code]...
How can I implement my rounding logic?
View 4 Replies
Mar 13, 2010
How to get numbers from a text box then use them in a math operation.
View 4 Replies
Mar 24, 2010
Similar in concept to Math.Abs() - I'm looking for a function that when given a positive integer will return the same integer. If given a negative, will return zero.
So:
f(3) = 3
f(0) = 0
f(-3) = 0
Yes, this is simple enough to write on my own but I'm wondering if the .NET Math class already has this built in or if the same can be achieved by cleverly chaining a few Math.* calls?
View 4 Replies
Dec 11, 2009
I am trying to figure out a calculation I can perform in C# to determine the rows per column. Let's say I know I am going to have 3 columns and my record count is 46. I know that I can mod the results to get a remainder, but I would like something more efficient than what I have tried. So I know I will have 16 rows per column with a remainder of 14 for the last column, but what is the best way to loop through the resutls and keep counts.
View 1 Replies
Oct 6, 2009
I have 36 numbers in sets of 5. (eg. 1-2-3-4-5, 2-3-4-5-6 etc..) I need to find all the possible combinations of these numbers which total the same sum. For instance the lowest sum would be: 1 + 2 + 3 + 4 + 5 = 15. The highest possible sum is: 32 + 33 + 34 + 35 + 36 = 170. Now every five number combination within these 36 numbers will sum up between 15 and 170. How would I go about this in vb.net to produce all the possible combinations which would total say 92.
View 6 Replies
Jan 31, 2012
For some reason the exception is caught sometimes it's not?Here is the code:
[code]...
View 21 Replies
Jan 9, 2007
does VB.NET include the Mathematical Integration/Derivation functions in the Library? If so where are
they, I couldn't find them? If not, any third-party libraries you would recommend?
View 3 Replies
Mar 13, 2012
Im working with a Picturebox in VB using the following basic math equations. [code]I believe that this equation assumes I am working in a coordinate plane where the following is true (0,0) is the bottom left corner of the Positive quadrant
-x increases as you move right
-y increases as you move up
I am working in a coordinate plane where the following is true (0,0) is the Top left corner of the positive quadrant
-X increases as you move right
-Y increases as you move down
The issue is I am not sure how this will affect my original equation for intersection point.
View 3 Replies
May 12, 2011
I'm having a problem with the Math.Abs statement. When I try to use this statement to figure the absolute value of a number, as in:
View 3 Replies
Jan 27, 2010
I use Math.Tan(str) for example (str = 35)
I become 0.47... But how can I calculte it in Deg., and Grad., to?
View 6 Replies
Jul 26, 2010
I am writing a program that rolls those crazy many-sided dice for use in fantasy games, and I have come to a point in my work where I am completely stumped. I am hoping that some of the more seasoned VB programmers on these forums might be able to point me in the right direction.
If this explanation gets a bit lengthy, please forgive me; I tend to be long winded. The feature I am trying to implement is that every roll result can have one or more "damage types" associated with it, such as "Fire" or "Acid". If I rolled a dice with "Fire" as the type, and the resulting dice roll was a 4, this would result in an output string of "4[Fire]". If there are more than one type, they are separated by commas like "4[Fire,Acid]".
The problem is when performing math while keeping track of these types. For addition and subtraction, there is little problem, "4[Fire]" added to "4[Acid]" is simple "8(4[Fire], 4[Acid])", while "8[Cold]" minus "4[Fire]" will leave "4[Cold]". Still with me? The problem comes into play when we multiply or divide rolls with types together. If we multiply "4[Fire]" and "4[Acid]", we get "16[Fire,Acid]" which is different than either "Fire" or "Acid" alone. Similarly, if we divide that "16[Fire,Acid]" by "4[Fire]", we are left with "4[Acid]", but if we divide by "4[Cold]" instead we will have "4[Fire,Acid]"
So how do I go about keeping track of this? Some of the dice strings my parser can handle might have dozens of damage types that might need to be figured into the total results. The result should display the total for the entire calculation, with results per damage type tracked separately. Currently I am using code that parses the string data above so that every type name is stored in an array with a integer variable associated with it for the total of that damage type. So, for the string "4[Fire,Ice]" I am storing the info in a variable that holds the 4 and an array that holds "Fire" and "Ice".
View 17 Replies
Jun 3, 2011
I'm wanting to search a RTB for all X coordinate values and convert them to SI mm units.
I have two issues: 1. My code is stopping after the first instance of match.success, I'm guessing i'm using nextmatch incorrectly? I have also tried matchcollections with no success.
2. I fear once we get it progressing to the next X value, any multiple X values with the same dimension will be replaced with my replace command, causing the new value to be converted again.
Dim MatchObj As Match = Regex.Match(RichTextBox1.Text, "[Xx](?<X>(d*.{1,1}d{1,4}))(s)*")
If MatchObj.Success Then
[Code]....
View 11 Replies
Apr 29, 2011
I have to perform calculations dynamically in ASP/VB.NET (Possibly SQL Server). Something like this:
Dim var1, var2 as Integer
Dim Optr as string
var1 = 15
var2 = 25
Optr = +
MyResult(var1, var2, Optr)
And MyResult should equal 40. How can I do this?
View 4 Replies