Getting Only Odd Integers

May 28, 2009

I'm making a program that will use .split and I only want to split every other instance. The way I want to do this is by splitting by only odd integers, how do I do this?

View 5 Replies


ADVERTISEMENT

Application That Will Display Positive Integers / Negative Integers And Zero Entered In A InputBox

Mar 20, 2010

I tried coding for an application that will display the positive integers, negative integers and zero entered in a inputBox. for some reason it keeps crashing down.here is my code. paging all visual basic professionals. [code]

View 6 Replies

Array Of Integers Comparing Integers?

Feb 2, 2012

Basically I have and array of integers that vary in size. I need to compare each number to each other number and display which number is repeated. For example:

Dim ints() As Integer = {1,2,2,5,4,6}

The number that shows up more than once is 2.

How can I run through the array and compare each integer with the numbers in the array. I tried a for loop but it didn't return the value I was looking for.

View 3 Replies

Add Up The Sum Of All The Even Integers From 2 To 50 In VB?

Jul 6, 2011

this is what i need done add up the sum of all the even integers from 2 to 50 in VB?

View 1 Replies

Choosing Between 4 Integers?

Feb 18, 2010

I would like to know if there is a command to make a program choose between certain integers. For example, I would like my program to make a random choice between the numbers 12, 118,224 and 300.

View 1 Replies

Using Integers In A For Next Loop?

Apr 8, 2010

Id like to use 4 integers in a For, Next loop. The integers are 1, 3, 7, 9. Is it possible to pass just these integers to the loop without putting them in an array or something similar?

[Code]...

View 20 Replies

Find Average Of Two Integers?

Apr 25, 2011

What is the formula in VB for finding the average of two integers?I know in normal math it is e.g. (4 + 6) / 2 it only needs to be the average of two values.

View 5 Replies

.net - Dealing With Large Integers?

Apr 19, 2012

So I am making a file crypter so that I can encrypt my VB.NET Application that I am making so that people can't decompile it. I had made this in C# and am transfering it to VB.NET, Everything worked fine in C# but once I had re-written the code in VB.NET i get this error inside of my RC4 Encryption method:

'Arithmetic operation resulted in an overflow.'

The error is occuring here:

Dim t As Int64 = (s(i) + s(j)) Mod 256

This is the same code above in c#:

int t = (s[i] + s[j]) % 256;

Is there anyway to make that calculation with it erroring? And why does it work in C# but not VB.NET?

View 2 Replies

Adding Integers In ListBox Using For Next?

May 4, 2011

I need to add integers in a listbox, using for next.
Dim intCount As Integer
Dim dblTotal As Double
' here are the lines of code that will perform the calculations
' to create a grand total.
For intCount = 1 To lstCosts.Items.Count
dblTotal += dblSubTotal += intCount
Next intCount
lblTotal.Text = dblTotal.ToString("C")

The amount of items in the list box is not seso I used the items.count. I have been getting the wrong result.
Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click
' Declarations.
Dim intCount As Integer
Dim dblTotal As Double
' here are the lines of code that will perform the calculations to create a grand total.
[Code] .....

View 2 Replies

Bug On Rounding On Division And MOD Of Integers?

Feb 11, 2012

I have a group of 25 labels named Label1, Label2, Label3, ... Label25 in a square of 5 per row, 5 per column and I wanted to assign the backcolor to all of them on a loop and assign a value of "True" or "False" to a matrix of 25 boolean values representing them.

But I was getting errors on the pattern created.

My approach was to use a substring containing a number copied from the label names:

Num = Val(sender.name.substring(5))

And the subindexes of the matrix:

p = (Num - 1) / 5
q = (Num - 1) Mod 5

The values for the lower corner of the matrix were rouded to 5 instead of being 4. Instead of (4,0) ,(4,1), (4,2), (4,3) (4,4) I was getting (5,0),(5,1)...(5,5)

So I solved the problem by creating two single variables "A" and "B", doing the divission and MOD operations on them, finding the floor of them and then converting to integer:

Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles _
Label1.Click, Label2.Click, Label3.Click, Label4.Click, Label5.Click, _

[Code]......

View 3 Replies

Change The Integers To Words

Feb 15, 2012

I have made a simple program for invoices, e.g. The total amount is coming 48,950/$, How to appear this amount in words "Forty Eight Thousand Nine Hundred and Fifty, through MODULE.

View 2 Replies

Check For Null Integers?

Jul 8, 2010

I am working on a program that has many integers (q1, q2, etc.), and each of them can be 0 or 1. This is dependent on which radiobuttons are selected. I need it to check and make sure that all of the integers have a value, but since "Null" is the same as "0",

View 8 Replies

Compare Strings And Integers?

Feb 10, 2011

I suspect there is something wrong in my application, specifically in a part where I have to compare a couple strings and a couple integers.

I do something like this:

If myString = myOtherString Then
do something
End If

And the same thing for integers.

However, for some reason, it is not returning true... also, I heard somewhere there were more proper ways to compare strings and integers.

View 1 Replies

Comparing Integers Using (And) In If Statements

Jul 11, 2011

I have a method that I want to check to make sure that both integers entered are both positive:
Public Function BothPositive(ByVal num1 As Integer, ByVal num2 As Integer) As Boolean
If (num1 And num2) > 0 Then
Return True
Else
Return False
End If
End Function

Now if I were to enter some numbers in
BothPositive(1,1) = True
BothPositive(1,2) = False
BothPositive(-10, 10) = True

Why is this? What is going on with the order of operations in the comparison statement or what is the "And" trying to compare? I don't see why this wouldn't work.

View 3 Replies

Convert Hex And Integers To Binary?

Jan 15, 2010

How do I convert hex and integers to binary?

View 5 Replies

Convert X And Y Integers To A Point?

Mar 2, 2009

I;m trying to learn from vb 6, and am having trouble with the simplest of things. I got a function that needs a point, im trying to feed it my 2 x and y integers and it can only accept a point. How can i convert my 2 integers into 1 point.

View 2 Replies

Distinguising Between Letters And Integers?

Jun 4, 2009

I have log files that are filled with a lot of content. All of the lines in these files read simliar to the two examples below:

2006-06-16 06:40:25 00.11.111.222 englased 172.16.3.4 80 GET /XXX
2006-06-16 06:35:00 222.222.111.111 GBEDEYA 172.16.3.4 80 GET /XXX
2006-06-16 06:35:01 222.222.111.111 CEADETAA 172.16.3.4 80 GET /XXX

From line one i need to extract englased, from line 2 GBEDEYA and so on.

I know that all the lines have GET, and basically I only need to exact the letter from the begining until GET to get what I need.

So i would read each of these strings until GET and gets the Index. Then I would need to record all the characters that are letters from 0 until GET (ignoring all integers and special characters).

View 4 Replies

Extracting Integers From A String?

Jan 3, 2012

My program uses the serial port to receive characters as a string, then it should extract the integers from this string. This seems fairly simple, but so far has been a very tedious job.

My string is called txt. The problem is that there's no telling how many characters / integers txt will hold at any given moment. For instance, it may equal "4" or "4 5 6 7" or "P 0 1 2 3 4 5 6...255" - with spaces included. I need to reference every number within this string to use as data. I've tried the following:

dim c as new char
dim n as new integer
dim i = 1

[Code].....

View 9 Replies

How To Have User Enter In 3 Different Integers

Feb 9, 2011

How do you ask the user to enter in 3 different integers?

View 17 Replies

How To Make The Variables To Integers First

Apr 25, 2012

I Know you cant sum to strings to each other so i trying to make the variables to Integers first but i can figure it out why it does not work![code...]

View 12 Replies

How To Use Mod Properly To Find Even Integers And Add To Get Tot

Mar 7, 2011

Sub Main()
Dim sum, counter As Double
Dim beginnum, endnum, btwnnum As Integer

[code].....

View 2 Replies

Prevent Integers From Being Rounded?

Feb 15, 2011

I have two textboxes that will contain numbers.I convert those text boxes to integers and then want to multiply them by certain values and then show the new value in a different textbox.For example,100 gets converted to an integer and then multiplied by 1.75 and the value displayed in the other textbox is 200 instead of 175.How do I make it so the value isn't rounded to the nearest 100? Here is my code, compTotalPremium.Text and collTotalPremium.text are the boxes that are showing the rounded value.

Dim Comp As Integer = compDedPremium.Text
Dim Coll As Integer = collDedPremium.Text
Dim CompMulti As Integer = compDedMulti.Text[code]....

View 4 Replies

Reg Ex - Find All Integers In String?

Nov 13, 2011

I have a following value "1pm 2am" that I'm using a regular expression againts in SSIS to extract hours from in order to store separately. I've tried using both of the regular expressions below but both only yield the first number "1".

"(d+)"
"(*?d{1,2}*?)"

View 1 Replies

Rounding Whole Numbers (Integers)

Mar 17, 2010

I'm a college student, working on a small project, and I'm having some trouble understanding the Round command on VB. The project is very simple and straight forward, just a simple Bail Bonds program to calculate the bail plus a 10% fee. However, i want to integrate a kind of "promotion", where for every $1000 of the bail cost, $5 would be deducted. I know the formula for this, which is reasonable simple, i just need to know how to round the Bail variable to the nearest 1000 so i can do this calculation.

View 9 Replies

Sort Integers In A ListBox In WPF?

Oct 12, 2011

I'm trying to sort items in a ListBox in a WPF project in VB 2010. I tried searching the web but I couldn't find a code that works (maybe I'm doing something wrong). Here's what happens everytime the user clicks on the button The timer "Generator" is fired The code in Generator_Tick make 6 random numbers (no duplicates), and adds them to ListBox1 Here I want the Items in ListBox1 sorted so Every item in ListBox1 is added to TextBox1 (in the order in which they are in ListBox1)This is just a test project so I didn't give the components a name):

Here's my code:

Private Sub Generator_Tick()
Do While ListBox1.Items.Count < 6
Randomize()
Dim Combination As Integer = Int(Rnd() * 30) + 1

[code].....

View 2 Replies

Split String Into Two Integers?

Sep 18, 2010

This should be fairly easy, yet I have no idea on how to approach this. Perhaps the split command . Anyway, what I need to do is split as string into two integers.

For example MyStringXS = "10, 20"
I need to end up with:
MyIntegerX = 10
MyIntegerY = 20

BUT!

These strings obviously change. So it could be MyStringXS = "120, 230" Or MyStringXS = "12340, 20342" And so on.

View 6 Replies

Split Strings Into Integers?

Apr 6, 2009

I'm trying to split an inputted string (txtStart.text) into separate integers. The split function works fine for me, but I can't figure out how to store the each part of the array... This is my current code that I based on an example from MSDN library:

Private Sub btnGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGo.Click
SplitStringIntoWords()
End Sub[code]......

View 27 Replies

Storing An Array Of Integers

Dec 4, 2009

I have a quiz I am building that randomly picks the questions from the database and displays them to the page. It seems like it might be hanging with the logic I have on the page_load.I am storing the questionid in a session comma delimited and keep looping through to get the next randomly generated number that isn't in the session. [code]

View 3 Replies

Subtraction With 2 Strings Of Integers?

Jul 10, 2010

if i have 2 textboxes and i want to do subtraction with textbox1 and textbox2.

The value inside textbox1 is "5 12 30 8 2"
The value inside textbox2 is "7 9 14 8 3"

May i know what can i do so that the result will be "-2 3 16 0 -1"???

View 9 Replies

VS 2008 For Loop With Integers?

Jul 30, 2009

I currently have a grid of 30 buttons, (6 x 5). So I named them btn1_1 - btn6_5

When the board loads up (this is for a jeopardy game) I have this

code
For counter = 0 To 5
Btn1_#.text = counter * 200
Next

Is there ANY possible way to do that (replace # with the number of the counter.) I doubt there is, but it never hurts to ask!

As a side note, where is a good place to post the jeopardy game that I am making in these forums, i tried both the code bank and gaming forums but they are dreadfully inactive.... since it is in VB.NET, i was wondering if i could post it here.

It is still in the making, but I would really like some feedback as i worked hard on it and got stuck for 6 hours on the save/load feature that was getting messed up cuz of a difference from A and a lol.

View 18 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved