Question biginteger

andrews

Well-known member
Joined
Nov 22, 2011
Messages
171
Programming Experience
5-10
I use visual basic in the latest visual studio and I put the code imports system.numerics.biginteger in a module but de code (type biginteger) is not recognized , it seems that I had to use assemblies or/and framework but I do not see these words in the add from project solution
 
Try just
VB.NET:
Expand Collapse Copy
Imports System.Numerics
this is with a .Net 8 VB.Net app EDIT: Using Winforms

I also created a module (make sure not to name your module BigInteger, this will cause a conflict.) that used it.
 

Attachments

  • Screenshot 2025-07-21 043906.png
    Screenshot 2025-07-21 043906.png
    20.1 KB · Views: 1
It would help if you understood what a type, namespace and assembly are.
  • Assemblies are executable files, i.e. EXE and DLL files. You reference a an assembly in your project to access the types it contains.
  • Namespaces are logical groupings of types in which every type has a unique name. You import namespaces at the file or project level in order to be able to refer to their member types in code without having to qualify them. For instance, if you use Imports System.Numerics then you can refer to BigInteger in code unqualified, instead of having to use System.Numerics.BigInteger.
  • Types are classes, structures, enumerations and the like. You would rarely import a type, although you might do so if it had nested types or you wanted to alias it.
In your case, it doesn't make sense to import the System.Numerics.BigInteger type. It does make sense to import the namespace that it's a member of.
 
OK, thanks, writing also biginteger.parse(word1.tostring) gives the solution
No it doesn't. If the type's not recognised then how is using the type name going to solve anything? This is pretty basic stuff. If you want to use a type then you have to reference the assembly that type is defined in. If you want to refer to a type without qualifying the name then you have to import the namespace it's a member of. That has been the way for over 20 years. It's also been the way for all that time that the documentation for a type will tell you what assembly it's defined in and what namespace it's a member of. Here is the documentation for the BigInteger type for .NET Framework 4.8.1. As you can see, you need to reference System.Numerics.dll and import System.Numerics. That may not be (and is not) the same for other framework version. It may be that VS automatically added the reference and import for you but that still needs to be done or you won't be able to use the type. Your code cannot use types that your project doesn't know exist.
 
Back
Top