Universal Variable Integer In VB?
Jan 27, 2010How would i create a variable for EVERY form, so that i could add/subtract from it no matter which form i'm on.
View 10 RepliesHow would i create a variable for EVERY form, so that i could add/subtract from it no matter which form i'm on.
View 10 RepliesSay I have something like this
Dim Level1 as Integer = 83
Dim Goal as String
Goal = InputBox(" What level is your goal?")
[code].....
I just need some syntax that will tell if a variable is an integer or not. I want to do something like this (i know this isn't correct syntax but this is the general idea):[code]
View 19 RepliesIn my assignment, i need to Swap of two integer variable without using third with VB.NET code. But, i still have no idea of how to do.
How can i do this with coding?
sgBox("********" + Microsoft.VisualBasic.Right(f, Len(f) - Len(vFilepath)) + " | File so ignored | " + i) where i is an integer, f and vFilepath are strings but I get the following message:Conversion from string "********~$SwitchSellReport - 230" to type 'Double' is not valid.All I want to do is put the number that is in i on the end of the string.
View 5 RepliesI have got the following
PHP MsgBox("********" + Microsoft.VisualBasic.Right(f, Len(f) - Len(vFilepath)) + " | File opened so ignored | " + i)
where i is an integer, f and vFilepath are strings but I get the following message:
Conversion from string "********~$SwitchSellReport - 230" to type 'Double' is not valid.
All I want to do is put the number that is in i on the end of the string.
Doing a calculation, variable is stored as an integer.It got too 2,147,483,647 before giving me an arithmetic overflow. Anyway i can increase the number it can hold?
View 7 RepliesConvert String Variable to an Integer?
I tried this[code]...
I don't think I fully understand passing values from a sub to a module. Here is what I'm trying to do (problem is at the '****):
[Code]...
I think I've seen something like this before - where the actual function returns a value. Is this possible? Or would I have to pass an integer variable from the sub to the function, and then return it back to the sub?
Using a "Numeric up down" or text box, how would i save the number the user picked to a variable and then add two to that number?
View 4 RepliesIs it possible to make a variable hold a reference to an integer instead of copying its value when using integerVariable = integerValue ?
View 2 RepliesI have a problem when debugging a code. On top of class I declare an array, and the length of array is an integer variable which is applied value below declaration of array.
E.g. class declaration
Dim array1 (2, integer) as string
Public Sub
integer = 5
End Sub
So basically, array is created with integer being 0 or whatever, because it is declared before integer was assigned a value. But the problem is, I need it to be declared at class variable so I can use array in different subs.
Is there anyway to customize a variable to use both an integer and a boolean value?For example. I am kind of making a simulation engine and using GDI as a visual aid, I am generating a grid of tiles for objects to be displayed, but I do NOT want to repaint all the tiles just the ones that have changed, so that I can save fps.So I thought if I could set a variable for the "tile number", "how many objects there are on a tile", and a boolean value for whether or not the tile needs repainted.[code]
View 2 RepliesIs there a way of testing to see if a number variable is an integer, or a decimal?
View 8 RepliesI want to assign the value of the integer returned from the InStr method to a variable. So, If TextBox2.Text = "The Apple Pie" And TextBox1.Text = "App", I want the integer returned, which in this case would be 5, put into a variable, lets say its called 'VarString'.
So VarString (would) = 5.
[Code]...
I am currently looking into the conversion of a string value to an integer. Obviously I will need to do some validation as to whether the passed value is in fact convertible to an integer.
At the heart of my question is this: the users' local is nl-BE (dutch (Belgium)), which means that we use a comma as decimal sign (and points as thousands separator); e.g. 123.456,78 would be a valid nl-BE number. Now, when using the numeric keypad, the
decimal key will yield a point, not a comma (weird huh!). So many user will enter 123456.12 and when converted to an Int, this should yield 123456.
The thing is that I want to cover all possible angles; both points and commas may be used as decimal sign by the users. So I wondering if anyone has written some code that deals with such a situation. I was thinking of an extension method that makes the
conversion based on whether a point or a comma is last used in the passed string (since no thousands separators should occur after the decimal sign).
I am a .net beginner trying to make a crossover from vb6. I am trying to copy bytes of integer to a variable but I am getting this error msg. PInvokeStackImbalance was detected
A call to PInvoke function 'Tutorial_Class Dog!WindowsApplication1.ModAPIFunc::CopyMemory' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.
Module ModAPIFunc
Public Declare Sub CopyMemory Lib "kernel32" Alias _
"RtlMoveMemory" (ByVal Destination As Long, ByVal _
Source As Byte, ByVal Length As Integer)
[CODE]..........................
I know vb.net does not include pointers like C language. but I am trying do populate an simple integer array with variable of the same type for example :
dim variable1 as integer = -1
dim variable2 as integer = -1
dim intArray() as integer = {variable1,variable2}
[code]....
it is a very simplyfied verson of what I want to do.I want to change the value of ma variables with my array referencing them with an index as if my variables were pointers of integer in c++ for example so that normally after the example, both variable should hold the number 3 instead of the number -1?
Using a "Numeric up down" or text box, how would i save the number the user picked to a variable and then add two to that number?a textbox would be preferable
View 2 Repliesmy function is to adjust a timer interval according to a integer variable.
Original code (works fine):
Code:
Dim UpdateSnakeSpeed
Select Case UpdateSnakeSpeed
Case currentscore > 199
[Code]....
This is the code I'm using right now. (works fine and is more logically correct than the above case statement. I have chosen to go with if .. end if statements over case, as I do not have a full understanding of what the variable SnakeUpdatespeed is doing in the Select case statement. If someone explains then I'll consider it. Also I know case statments are only meant to be used for 1 option selections, however I'm amazed that it still works in case. Atm it's going to be if end if. Now I'm trying to get the for next loop going with this (if it's logically possible). that's what i'm aiming overall out of this thread. To make a convenient loop.
Ive got a few strings stored inside a string array, and i need to copy each string element into the integer variable on each iteration.how i would convert it? tried
CInt(stringArr(lc))
but got errors?
Doing a hangman game for class need to know how to declare a form level variable named intNumTries of type integer?
View 1 RepliesIm trying to set a background image for my Form. The problem is that the form contains textboxes, groupboxes, labels and panels, so I have to manually set the picture for each type of objects. That looks weird though because you can tell that the same picture has been placed a lot of times for each object. Is there a solution to this?
View 4 RepliesThe connection string generated by VB only works for my computer because of the path and even tho within the program I used paths which only include the name of the file i need to load when i do that with the DB it doesn't works.
This is the message i get: An attempt to attach an auto-named database for file Database1.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
How to Use an event inside an event but universal. I only want to trigger the textbox text changed inside the button click event.
Private Sub EditButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EditButton.Click
'
' Insert textbox.textchanged Event
'
End Sub
Until recently I have been using net 2005 with distributing an app which uses an access database with getting data using recordsets
I decided it was time to upgrade so I got net 2010 & started using ADO.net with a dataadapter.
To my dismay I have found that my app will not run on all platforms, ie XP, Vista 32 & 64 bit, Windows 7 32 & 64 bit From another question I have been told
"If compiled to target AnyCPU, your program will fail to run in an x64 environment if it utilizes any ODBC database driver. In this case, you must compile it to x86. Therefore, x86 is safer than AnyCPU."
Which I have found to be correct I am not familiar with all the options to open a database & the respective code required to extract/change the database data. I also don't understand the implications of using x86 cpu instead of any CPU
MY net 2005 apps have been working fine for the last 6 years (until W7 64 bit), so I want to develop an app that has the same lifespan without having to make variations to the build for specific platforms
I would like the answers to the following:
1. is x86 the new standard for specifying cpu & works on all platforms?
2. why does W7 64 bit have a windows & windows x86 system folder
3. why does my installer when "any CPU" is specified install it in the x86 system folder (W7 64 bit, even though the app fails when trying to open the database as outlined above)
4. which method of opening an access database is preferred which works on all platforms with a common cpu specified?
I am trying to convert visual basic 6 code to vb net. How do you in Visual basic .net get the universal naming convention.
View 8 RepliesA While back I developed a application that connected to Excel using DB connection. It worked fine since the application was designed for usage on one particular PC with Excel 2003. I especially liked the solution since the data retrieval was much faster compared to what I would get if I connected to Excel using Interop libraries.
However, recently when I tried to implement the same solution onto another app that would run on various PC that could use different versions of MS Office I ran into multiple problems. First of all, I can't use the same connection string on various versions. Also, the whole x64 vs x86 thing is adding to the problem.
I wonder if there is a way to check the version and use the apropriate connection string for every version?
I'm creating 10 web browsers at runtime, they are all in WBS() array and i need "navigated" event for all of them with ability to identify sender. Either 1 event for this array or event for all web browsers and then i would just check it they are the ones from array.
View 2 RepliesI have run across exam ples of how to create code for getting the universal naming convention for mapped drive in VB6 and access but that don't work in VB net.
View 4 Replies