VS 2010 FYI - Factorial Using BigInteger?
Jun 23, 2010Imports System.Numerics 'have to add reference Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
[Code]...
Imports System.Numerics 'have to add reference Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
[Code]...
.Net 4.0
Option Strict On
Option Explicit On
This works perfectly:
Dim N As BigInteger
N = 28 'Put whatever value you want in for N.
Write((BigInteger.Log(N) / BigInteger.Log(2) + 1) / 2)
This does not work:
Dim Result As BigInteger = (BigInteger.Log(N) / BigInteger.Log(2) + 1) / 2
This gives an error during the build (despite the variable being declared as a BigInteger and the operation working perfectly well when I am not assigning it to a variable, it tells me I can't convert a Double to a BigInteger) and I have to do this:
Dim Result As BigInteger = CType((((BigInteger.Log(N) / BigInteger.Log(2)) + 1) / 2), BigInteger)
This if course gives a different, that is, incorrect result.'This doesn't work either.
Dim Result As BigInteger = BigInteger.Log(N)
'I can do this:
Dim ResultString As String = BigInteger.Log(N).ToString
'But then parsing the string fails
[code]....
what the maximum and minimum values are for a Framework 4.0 System.Numerics.BigInteger
2 ^ x
or is it a
( 2 ^ x ) - 1 value?
Develop an application which reads two integers n1 and n2 from the user via two textboxes and displays in a label the sum of the factorial of the integers n1 and n2?
View 3 Replieshow to find factorial
View 1 Repliescan you write an algorithm which can calculate 500 factorial.scientific symbol(mode) is unauthorized.Answer should be in String mode.
View 1 RepliesTrying to figure out how to calculate factorials via loops. Cant seem to figure out where to start when using loops.
View 9 RepliesNeed to take the number from a textbox and get the factorial
Public Class Form1
Private Sub btnCalculate_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnCalculate.Click
[Code]....
calculate the factorial of given number using recursion.input the number in textbox and show the
result in another textboxrajeev ranjan, on 29 March 2010 - 12:38 PM, said:calculate the factorial of
given number using recursion.input the number in textbox and show the result in another textbox.
This is a math calculation which is using factorial.
[Code]...
So I need to get a button to take the number that a user enters into a textbox, calculate the factorial from that number, and display it in another textbox. I can't seem to get this to come out right.
Here's some of the code I've been playing with.
Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click
Function Factorial(ByVal txtFactorial As Decimal) As Decimal
If txtFactorial <= 1 Then
MessageBox.Show("Enter a number greater than 1")
Else
txtAnswer = Factorial(txtfactorial - 1)
End If
End Function
Now I have to just work out the code part. Can a function be under a button? I'm getting an error about that. I'm also getting an error about the txtAnswer=Factorial(txtfactorial-1) part of the code.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click.[code]the program enters a number and display its factorial, our program has error, eg. if your going to input 7, the result would be {num1}5040.we are having difficulty in its result... the required output should be 1*2*3*4*5*6*7=5040
View 1 RepliesCan someone explain to me what the difference is between a recursive function and a factorial function. I know that a factorial function returns the product of all the numbers from 1 to itself. But how does that differ from what a recursive function does
View 2 RepliesWhen trying to import CrystalDecisions.CrystalReports.Engine, and CrystalDecisions.Shared. I'm getting a green line. What might be the problem?
View 3 RepliesI'm new to visual basic, used it for a few months. My friend is addicted to using a program called Wpe Pro [URL].. and he wanted me to make it more advanced and able to do more stuff.if you no anything about this program please message me
View 5 RepliesVB.Net 2010 program .exe on PC with Excel 2007 gives error when cannot find Excel version 14, which is Excel 2010 I have developed a program in VB.Net 2010 which reads from an Excel spreadsheet. It works fine in the IDE on my computer. I built an .msi and executed it on my computer. I get "Error: 53 - Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=14.0.0.0, Culture=neutral,PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The system cannot find the file specified."
The only version of Excel on my computer is 2007, which is version 12.0.6557.5000. The version the error says it needs, version 14, is actually the version of Excel 2010.I have put in MsgBox statements to find where the error occurs.
[Code]...
At present I have wrote an application (in-house CRM, vb .net 2010) which allows me to send emails under the selected customer & I categorised these emails.As these are categorised I can return data to display email history in my program by using search criteria:
Dim oMail As Outlook.MAPIFolder = oNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderSentMail)
Dim sSearch As String
sSearch = "[Categories] = '" + "[" + tAccount.Text.Trim + "]" + "(" + tShipTo.Text.Trim + ")'"
Dim oItems As Outlook.Items = oMail.Items.Restrict(sSearch)
However the limitation to the above is it only looks at sent items & no other folder.My ideal solution would be to display all email correspondence for a certain contact.
The situation: when i build my project (or publish) Visual Basic 2010 makes and exe and a couple ddl files. when i run the project with the .exe and the other files the program works perfectly.
My problem: I want to share it with friends and it is just a verry little program ( a n internet radio) so i want it to be 1 .exe with out any other instalation needed so i can easly share it to anyone who wants it. when i make an even smaller program and Debud->build it, it is only 1 exe and no instalation needed. so is there a way to make my program to 1 exe only?
Basics Details:
VS 2010
Making an Addin for Excel 2010
Win 7
Problem:I am not getting the cursor (4 arrowheads) for moving the form.I am using the Panel1_MouseHover to display the cursor. Right now if I choose any other cursor then it is working but the same cursor also displays when I hover the mouse over any other control. I want the cursor to show only in the areas of the Panel where there are no controls.How do I show Tooltips for the images? The play,stop,next, previous,playlist,Hideme(with the smiley),volume are all images and not buttons?
Well I used the Visual Studio 2010 installer to install my application and I want it to be able to change the version displayed in the in the Add/ Remove Programs (in the Control Panel). How can I do this without going through the install wizard again?
View 3 RepliesIf I create a DLL using VB 2010 express can it be used by previous versions of of .Net (3.5, 2.0)? Will the DLL use .Net 4.0 components, which is what I want. I don't see a way to force that to be the case.
View 1 Repliesthis is my very first posting and I must say I am desperate. I have a VB assignment due in 2 days and I am so lost. I have written a code to draw some graphic, just a basic house, tree, sun etc. I have also written a code to magnify said graphics which were all the specifications of my Assignment 1 part A. Now for Part B I am being asked to extend my program so that: A - My graphic can be drawn using different colour schemes designed by me but chosen by the user B - My graphic or an appropriate part of it can be animated around the picture box if the user chooses to do so. C - Error checking is included.
[Code]....
it's just for a program registration. i would store all of the registration codes in the access database, then export it to XML, then upload it to my web host. I would then somehow connect it to my Visual Basics login form (Which I have already made). If this can't be done, having them register through the form and having all the allowed codes on the internet (So i can easily edit them)!
View 5 RepliesIs it ok to install my VS 2010 Ultimate even if I already have VB 2010 Express Edition? or should I uninstall the express edition first?
View 3 Replieswell until a few day ago. I don't know what I have introduced to cause the problem but now, whenever I load the project, VS 2010 (SP1) crahes. If I delete the project's suo file, the project loads (really quickly) and all is well until I exitVS 2010. When I re-run it and try to load the project, it crashes again unless I delete the suo file.The program can be built for x64 and x86. Now, when I reload the project (after deleting the suo file), it comes up in Debug - Any CPU mode. I can change from Debug to Release and from Any CPU to x86 but if I try and change from x86 to x64, VS 2010 crashes.This is not always the case though. If I build the x86 version and then switch to x64, all is well and I can build the x64 version. Obviously, there's something wonky going on.
View 7 RepliesI need to write from VS 2010 vb.net dataset into a newly created xlsx file.
View 2 RepliesHere are my questions concerning VB 2010 Express:
1. I've registered my VB 2010 Express, will it still expire?
2. Will the applications I made using VB 2010 Express expire after some time?
3. Is it OK to write my code in the designer.vb file? I don't know why, but when I started writing my application it took me to the designer.vb instead of form1.vb code.
4. I've been working on an application for a week now, but suddenly I can no longer access my Design View(Shift-F7). All my codes are written on the [form name].Designer.vb. I can still view my codes but I cant access my form layout. On the solution explorer, my forms no longer have the 'form icon'. When i press Shift-F7 nothing happens. Right-clicking the form on the solution explorer doesn't show 'View Designer' option. How can I fix this?
I have a datagridview populated from a CSV file in vb.net. I have 2 datepickers, 1 button. see the attached images. Image1->before filtering
[Code]...
Dont be afraid to spam the thread with things you can create.The more the better!
View 2 RepliesI'm having a little trouble trying to read a word document in vb. how to get the text out of the word document would be great.
View 4 Replies