Any Arithmetic Variable That Can Hold A Number Long
Mar 3, 2012i am reviewing variabes, and just wondering any variables that can be used in math to hold a value this big =)
[Code]...
i am reviewing variabes, and just wondering any variables that can be used in math to hold a value this big =)
[Code]...
I keep getting an over flow.I have two longs. The first is set to 16552800. I can add 32760 to it no problem. However I get an overflow error when I add 32820 to is.
View 1 RepliesI would like to know how to declare a variable that holds bits.
View 11 RepliesIs it possible to make a variable hold a reference to an integer instead of copying its value when using integerVariable = integerValue ?
View 2 RepliesHow do i make a variable that can hold more than 1 piece of data. I wan't a variable that can keep 4 number in it. When i count them in using a for loop the only thing i have after it is finished is the last number counted in by the for loop.
View 2 RepliesHow does the GC dispose objects created in the following 2 scenarios?
1)
Private Function DoSomething() As Boolean
Return New DatabaseManager().Insert()
End Function
2)
Private Function DoSomething() As Boolean
Dim mngr As New DatabaseManager()
Return mngr.Insert()
End Function
In Option 1, I don't create local variable to hold the reference of the object. In Option 2, I hold the reference in local variable.What option is better and why? (if any)
1) Is it possible to set the maximum number of characters that a string can hold?
Just like the following example from VB6:
Dim my_var As String * 10
2) I noticed that Option Base 1 does not exist. I created a table my_table(2) and tried to msgbox the following[code]...
Is there any container that would hold a number that is 10,000 characters in length? would I have to create one? If so how would I go about doing something like that?
View 5 RepliesWhat's best practice (in VB.Net):
Function GetSomething() as String
GetSomething = "Here's your string"
End Function
or
Function GetSomething() as String
Dim returnString as String = "Here's your string"
Return returnString
End Function
Obviously, neither of these implementations make any sense, but they're just meant to illustrate my point. Is there anything to be gained by using GetSomething itself to store the return value instead of declaring returnString locally and then returning that (does it avoid having an extra string allocated/instantiated - and if so, are there any performance/memory benefits)?
So I do not know at design time if the var ms is going to be a stringreader or a memorystream. So I am trying to do basically this:
Dim ms as object = myfunction...
Dim mytype As Type = ms.GetType
Dim returnedobject = ser.Deserialize(CType(ms, mytype))
But I get an error saying "type mytype is not defined". How can I do this?
I need to be able to count the number of days a person is on hold. easy enough! However i need to be able to stop the expression when I enter a stop date so it would look like this "start date 1 to today= x amount of days" but i need to be able to add a stop date to end the counter. and if they go down again start date 2 to today and add number of days from start date 1.
View 1 RepliesIs it okay for a structure variable to hold a small number of reference types? I thinks it's fine because the pointers themselves are not that big, regardless of what they're pointing to. But I never did fully figure out the whole heap/stack thing, so I'd like to make sure.
View 6 RepliesWhen using the variable tTimeInterval as Long trying to reassign the variable in the timer's sub,
but the tTimeInterval is 0 after enter in the sub,,
Public tTimeInterval As Long Sub Main()'Dim param_obj(2) As Object 'param_obj(0) = "sdaddsa"
'Dim aThread1 As Thread = New Thread(AddressOf SendingMessage4)
'aThread1.Start(param_obj)tTimeInterval = 5000
[Code]...
I must convert string data from a CNC that is arithmetic expression to a number that I can use in a VB application that I wrote. The following is what I get out of the cnc. [18722*65536+19377]/67108864. I need to evaluate this expression in my VB ap. The format of the string is not always the same as what I have illustrated.
View 2 Repliesim sure im mis-wording the concept but here it is anyways. I know in CSharp you can do
el.AppendChild(new UISize(file, "TSize") { CX = 95, CY = 20 });
which declares a temporary bucket variable and then assigns the associate property values to the variable. Which then sends it to the XMLElement AppendChild method. What is this design concept called? What is the conversion to VB.Net? I have tried using my own online utility that does a 90-95% conversion rate from C# <-> VB.Net. It has failed in this instance, and so need a hand-up on what i am looking to do to convert this from C# to VB.Net. I would really like to not have to do a long-declaration of a variable with assignments, if at all possible.
I'm trying to generate random dates in between two dates that are selected with a date and time selection control.Ideally, I would like to get the 'ticks' of each date, generate a random number between those, and then convert that back into a date.However I'm getting arithmetic overflow errors when I try to generate a random number from the between the ticks. I've tried many approaches - directly seeding with both the low and high date ticks, as well as subtracting.
Private Function randomDate() As ULong
Dim rand As New Random(Date.Now.Ticks Mod Integer.MaxValue)
Dim holder As ULong = DateTimePicker2.Value.Ticks - DateTimePicker1.Value.Ticks
[code].....
With this code...
vb
...Dim random As Long = RandomNumber(1000000000000000, 9999999999999999)... Private Function RandomNumber(ByVal Min As Long, ByVal Max As Long) As Long Dim Random As New Random() Return Random.Next(Min, Max)End Function
...I am getting a OverflowException. Is it so that Random class can't handle Long values?
i'm having trouble with the relationships in VS when relating from long to Autonumber.I got an answer that fields should be declared integer, but ACCESS explicity states that fields realting to autonumber must be delared long.
View 3 RepliesI would like to ask for some on how to create a random string with number and letters in 8 characters long in VB 2008
View 1 RepliesMy homework assignment is to create a project where a user enters a password that must be at least 3 characters long with at least 1 number and 1 alphabet character. After that the password has to be encrypted so that vowels become X, numbers Z, and it reverses. For example, a password of CS2301 would be ZZZZSC. There's supposed to be Loops to extract 1 number/letter at a time and search for them in the string to validate, and I don't know what to do. The form itself has a Text Box to enter a password and a label to display the new one, and a Go button.
This is what my code looks like so far.
Option Strict On
Option Explicit On
Public Class Form1
[CODE]...
Is there a easer way of coding in stead of wrighting long long paragraphs like this in one line [code]All of this is on one line and i got lots of info to put down.."The game will begin on your 16th birthday with your mother waking you up. Today you are to go to the castle for the first time. Leave your bed and open your dresser for a Strength Seed. "
View 2 RepliesWhen i try to stablish a relationship in dataset designer of these two types i get a "no matching field type" error I'm working with an accdb database
View 2 RepliesWhy define a variable "As Long"? And how does it differ from "As Variant"?
View 1 RepliesIn Visual Studio 2008 I am using :Private Declare Function BlockInput Lib "user32" (ByVal fBlock As Long) As Long To stop input from occuring during a search-replace operation.
BlockInput(True) ' do not allow input during search and destroy
Dim cursorIcon As Cursor
cursorIcon = Cursor
Cursor.Current = Cursors.WaitCursor
Then setting it to false at the end of the operation. It did not work, so I thought maybe it was because I was calling it from a child window, so I created a function in the mainwindow, and ran it like this:
FrmMain.BlockFrmMainInput()With these functions is the Main window:
[Code]...
It did not solve the problem. I thought maybe it was because I was running under the debugger, so I tried compiling and running it debugger-free, but that did not do any better. I am still getting input when I double-click the mouse on either form.
i have this variable Dim odddivider2 As Integer = CInt(20 6) and i want to expand the number 2 like a variable from 2 to 4.5 how i have to make that
View 14 RepliesI am trying to design a Function/Sub that will need to accept a variable number of parameters. Catch is that the parameters being passed are arrays themselves. As i understand it when you pass a variable number of arguments to a method, you pass them via an array. What im looking for is to make a method that would accept this form:
[Code]...
I have 10 variables that have numbers at the end in sequential order (e.g. V1, V2, V3, ect.). I would like to perform a function to find what the position is in an array and then add then add the value to the correct variable. Can I combine V & and the number to manipulate the variable?
View 2 RepliesI am making a simple console game. If you have ever heard of the board game code breaker you will understand better.
In my version of the game you will have to figure out a four number combination. The only numbers it can be is 1, 2, 3, or 4.
I need to generate four random numbers and put each on into its own variable. This allows me to call back each number.
How do I do this? I have been doing some research on random numbers and I use this code to generate four random numbers
Dim rnd As New Random()
Console.WriteLine("20 random integers from -100 to 100:")
For ctr As Integer = 1 To 20
Console.Write("{0,6}", rnd.Next(-100, 101))
If ctr Mod 5 = 0 Then Console.WriteLine()
Next
Console.WriteLine()
But I can't figure out to put each number into a variable so I can call the same numbers back.
If i have a variable '12'
and a variable 'hello'
how can i double the '12' each time the variable is used?
What im trying to do is have a textbox which the user writes in a number, the number they enter then determines the amount of times a variable is written in a textbox.
so if the user were to put '3' into the textbox and click go, it would print hello12hello12hello12, how can i increase the number 12?
what i want it to do is look like this when the user presses go: hello12hello24hello36
How can I get a Variable's value set to the number of Data Fields in my DataBase that is NOT Nul.
I have in a table 10 fields or columns Named: Ing1, Ing2, Ing3, Ing4, Ing5, Ing6, Ing7, Ing8, Ing9 and Ing10. This fields will all most never all be fild, will be fild from 1 upwords. I need to know how many of them is NOT Nul.