Convert A Value Of A Numeric Up Down To A Variable?
Jan 15, 2011How do you convert a value of a numeric up down to a variable?
View 1 RepliesHow do you convert a value of a numeric up down to a variable?
View 1 RepliesIn VB 2010, I am trying to use this query, but I always get an error message because the numerical variable CHAVE is not correctly called. STATUS and HISTORICO are string type fields, that will be filled by the string variables SITUACAO and DESCRICAO.DIA is a date type field and will be filled by the date type variable PROXIMA.CHAVE is a numerical field and should be filled by the numeric variable CHAVE.
sql = " INSERT INTO " & conta & " (status,dia,chave,historico)" & _
" VALUES ('" & situacao & "', #" & Format(proxima, "M/d/yy") & "#, & chave &, '" & descricao & "') "
how do i format a variable at runtime.
Here is my code
string cool = // some numeric value e.g. 500000
Label2.Text = " Payment of " + cool ;
[code].....
So I know ("C") converts it to currency, but when I do that I get "Expression is not an array or method, and cannot have an argument list."[code]...
View 2 RepliesI am reading a pot that has a range of 1000 to -887.I need to convert that numeric value to represent 0 to 1024Where 1000=0 and -887 = 1024.
View 4 RepliesI have an application where the user and search the database and return the values from it. They can also figure the Average, Median, and the Standard Deviation from it. BUt I have a problem with this since the business rules won't allow the result column to be anything but a string so now I am getting error messages on the Select commnad text since it is trying to perform the calculations. I am wondering if there is a way to convert the values in the command text to a numeric value then perform the calculation. Here is the code I am using at the moment.
[Code]...
I am using VB .net 2010 express from microsoft. I have a numeric up down box to display a variable that the user can choose a number for. Then I have a text box that I want to display a result of the updown box * 1.5... So far I have the following... What do I need or need to change? I have the integer variables initialized or whatever with Dim statements as follows -
'speed variables
Dim CruisingSpeed As Integer 'cruise speed - updown box
Dim FlankingSpeed As Integer 'Flanking speed - will be cruise * 1.5
[CODE]..................
It says that it cannot convert the up down box into an integer... I need it as an integer to calculate the other number...
Complete code just in case the above was not enough info...
'Imports Excel
'Imports System.IO
Public Class Form1
[CODE].............................
I have some stuff commented out because a variety of issues - some I will end up using and some I will end up taking out before it is done...
am new to VB programming and i just encountered an error saying i can not convert data type vachar to numeric and my db is SQL 2005 and data type for ALL columns is varchar. please can anyone HELP. this is where i am getting the error: myInsertQuery = "INSERT INTO hotrrefuge( [REGISTRATION_ NUMBER],surname, firstname, othernames, office_address,title,
[Code]...
I need to convert numeric string to date in format dd.MM.yyyy :(
View 2 RepliesWhy are static variables set equal to 0 in the declaration when 0 would be the default value of the numeric variable anyway when it's first declared? Not including the "=0" in the static declaration seems to work with no problem.
View 2 RepliesIs there a numeric text box, not an up-down box, a SIMPLE numeric box into which the user can place a number, 5 boxes actually, then on command have the five boxes added and the sum displayed?
View 8 RepliesPublic Class Form1
Private Sub btnCompute_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnCompute.Click
Dim percent As Double
[Code]....
Above is the code i have created. I am having issue with the variant "Percent" to display 37.50% instead of 37.5.
I have a variable (double) which has a constantly (infinitely) changing value. I would like to store all the values of this ONE variable into an array. My variable and array are:
Dim x as Double
Private y as Double() = New Double (499) {}
I tried doing this:
[code].....
sRndMessageNumber = "sNewMessage" & CInt(Int((3 - 1 + 1) * Rnd() + 1))
I want to Calculate a number between 1 to 3 and then call the variable sNewMessage2 for example. So how to convert from string to variable?
I'm working on a home project using DirectShow.Net. to learn some VB.net. Most of the examples I've found have all been in C# so I'm looking through code for ideas and converting where I need to. I keep stumbling upon these declarations and I'm unsure how to convert it to a VB.Net statement.[code]Then the second part seems to be assigning the value but as its made up of two parts im unsure how that works?
View 2 RepliesI'm programming a basic slot machine in Visual basic, and want to use a for loop to randomly choose the image for each slot, display the image in each slot, and change the slotName variable (so I can check later on which symbols are in the slots) for each slot. The problem I'm finding with a for loop is that the variables and objects for each slot have different names (slot1Name, slot2Name, slot3Name, lblSlot1, lblSlot2, lblSlot3, etc). Is there any way I could have could something like:
currentSlotName = "slot" & i & "Name"
This is the code at the moment, this code is repeated (with different variable and object names), for each of the 3 slots, which is pretty inefficient.
' Randomise numbers and assign images to slots based on random numbers, if the hold isn't on
' Slot 1
If Not held1 Then
slot1Value = Int(Rnd() * numbersGenerated + 0.5)
Select Case slot1Value
[Code] .....
Convert String Variable to an Integer?
I tried this[code]...
Here's my problem :
Let say I have a variable called A
Which value is 100 ( A = 100)
In a form, I have a textbox, where I want to enter a variable name
textbox1.text="A" for example
Then I want to display the value of that variable
msgbox (somefunction(textbox1.text)), which will popup 100
I read some info about Reflection, but they all seems to refer to controls and not simple variable
[Code]...
Now I'm wondering if it is possible to convert text to one variable defined up i.e.: dim mycolor as string
[Code]...
Is it possible to convert string mycolor to Color variable as defined before?
I am using the following function to Convert a String variable to a Date. Subtract a day from it and convert the date back to a String. The code goes as follows
[Code]...
If edate has a value 29/12/2011 than the value in expenddt gets changed to a different format and the value in expenddt comes to 12/29/2011 and later after subtracting a day expenddt is 12/28/2011 and than when i convert it back to a String i get the value in asd as "12/28/2012 12:00:00 AM"
[Code]...
Dim phone As New Regex("(?d{3}[) ]s?d{3}[- ]d{4}")
BUT I can't use it with txt1.text = phone as it isn't string.
How can I set new regex as string ?
I have a string value of form names in my DB so when my condition passes, the variable string will take over the value , then that value will call the form(variable) as string.
[code]...
I am developing an application which initially allows the user to browse and select a save location. The selected path is assigned to a public variable which is used with concatenation to crate folder for saving user input data. How can I change the path string to a constant so the user can run the program again without having to run setup routine unless they want to change the save location?
View 1 RepliesI 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).
How do i convert string to raw binary and display save it in variable?
i can do it when i write the string to file :
Dim data As Byte() = Encoding.GetEncoding(862).GetBytes("שלום")
Using writer As New StreamWriter("C:lasttest.txt", False, Encoding.GetEncoding(862))
[Code].....
how can i, for example add a datum from the rs232 with other variable here is my code:
Dim ii As Byte
Dim c(100) As Char
c = Me.SerialPort1.ReadExisting()
[Code]....
I am reading a data file and storing them in an array of string.Data is random, could be like "1","2","133,18" but sometimes there can be missing values like "?".Once I load the data in the array, I want to check if at least a majority (like 60% of them) are numeric values.If yes, then I wanna track down the higher and lowest value in the array, and output a range of 5.Loop through the array
If 60% of them are numbers (integers or decimals) then find highest value, find lowest value end if produce range
If for example lowest = 1 and highest = 100, range of 5 means 0,20,40,60,80,100 (so 5 ranges are 0-20, 20-40, 40-60, 60-80, 80-100).Also if the ranges turn to have decimals due to weird numbers, I would like to round them up.My problem is, in order to find highest and lowest when there are non numeric values in the array like "?", how should I handle those? I was thinking of something like Double.NaN but I would have to have an array of doubles.
I want to use explicit conversion (CType function in VB.NET) to convert the variable d from double type to integer type and store the result as 132.
Imports System.Console
Module Module1
Sub Main()
[CODE]...
This is my code. But Visual Basic tells me an error: Error1Type 'i' is not defined.C:\Users\mihaispr\Desktop\Conversie explicita\Conversie explicita\Module1.vb1922Conversie explicita
I am getting the error:"Range variable 'sender' hides a variable in an enclosing block or a range variable previously defined in the query expression."for this
Imports System.Data.SqlClient
Imports System.Linq
Public Class Form1
[code]....
I can select any other item from the table without the error. "sender" has the same properties as "receiver" in the SQL table.
I receive the error -
[Code]...