Finding The Smallest Number Evenly Divisible By 1-20

May 14, 2009

i just started to learn mod and i was having trouble with this. heres my code:

[Code]...

View 9 Replies


ADVERTISEMENT

Check If A Number Is Evenly Divisible By Another?

Jan 20, 2012

I was wondering what the fastest way is to check for divisibility in VB.NET.I tried the following two functions, but I feel as if there are more efficient techniques.

Function isDivisible(x As Integer, d As Integer) As Boolean
Return Math.floor(x / d) = x / d
End Function

Another one I came up with:

Function isDivisible(x As Integer, d As Integer) As Boolean
Dim v = x / d
Dim w As Integer = v
Return v = w
End Function

View 4 Replies

Fast Way To Check If A Number Is Evenly Divisible By Another?

Feb 13, 2011

I was wondering what the fastest way is to check for divisibility in VB.NET.I tried the following two functions, but I feel as if there are more efficient techniques.Function isDivisible(x As Integer, d As Integer) As Boolean Return Math.floor(x / d) = x / d End Function

Another one I came up with:

[code]...

Is this a more practical way?

View 3 Replies

Determining If Numbers Are Evenly Divisible

May 30, 2012

In my order program, I need to determine if the quantity ordered is full boxes.For example - all of our parts/products have different box quantities, and when a customer orders a certain quantity, I want it to do nothing when I type in the quantity IF the order quantity is even boxes, If it is not even boxes, I want a pop up form with three radio buttons to come up. The three radio buttons will have the next higher even box quantity, the next lower box quantity, and to keep the current quantity and apply a broken box charge. I have this pop-up form done except for determining if the order quantity is an even number of boxes, and then determining the next higher and next lower.

Just to clarify - let's say a customer orders a part that has 60 pieces per box. If he orders 180 pieces, nothing happens and you can continue to put the order on. If he orders 200 pieces, a pop-up form with 3 selections - "keep current quantity and apply broken box charge", or "Change Quantity to 240", or "Change Quantity to 180" comes up.

View 5 Replies

VS 2008 - Finding Highest / Smallest Number From List Of Values

May 10, 2011

Create a program where the user can find the highest number and the smallest number from a list of values It needs to operate as follows: Enter a value (number) in the TextBox and click on a button [Add to list]. Once this is done, the program analyzes if the number is the highest entered or the smallest. To view which is the smallest and largest, a second button [highest and lowest] will populate fields (texboxes) with highest and lowest numbers. I've attached an image of what the program should look like.

View 4 Replies

Finding Smallest Integer But Larger Than Zero?

Apr 21, 2009

retrieving the smallest integer from an image data (image data has a data type of byte which means that numbers range from zero to 255) but if smallest integer is zero than the next smallest number which

View 1 Replies

VS 2008 Finding The Smallest ASCII Value?

Nov 7, 2010

I've been practicing how to use Loops. So I'm trying to create a program where a user enters 10 letters and I have to find which character has the smallest ASCII value.

example: If someone inputs "qwerTyuio" my output should display "T"

Now I think I got my program to get the ASCII values of a string but I can't figure out how to compare each ASCII value of each character.

Dim str, y As String
Dim x As Integer
str = txtLetter.Text

[Code]....

View 6 Replies

Get The Nearest Number Divisible By 10?

Jul 6, 2009

For example, how would I get the # "220" from the number "229". Or the number "300" from "309"? The only way I've found to do this is using string stuff, but I'm afraid of the overhead for strings?

View 15 Replies

Converting Some Php Code That Tries To Get A String To A Length That Is Divisible By A Certain Number?

Dec 10, 2009

I'm converting some php code that tries to get a string to a length that is divisible by a certain number, say 10. To do so it appends "�" to the string to make up for the difference. In other words, it does something like:

dim difference as integer = 10 - (str.Length Mod 10)
for i as integer = 1 to difference
str += "�"
next

But the problem for me is that "�", which is the ascii code for the null character, is two strings and I don't believe that when VB loops over resultant string it will view that as one character. what could I append the string with to retain the expected behavior?

View 1 Replies

Getting Largest And Smallest Number From An Array?

Sep 5, 2010

Getting largest and smallest number from an array and placing in 2 dif Posted 02 November 2010 - 05:34 PM I have the code written for everything except when I try to display the highest and smallest numbers from the array into a label it display 0 for both the smallest and highest number.Question: Create an application that lets the user enter 10 values into an array. The application should display the largest and smallest values stored in the array.

*The form is a list box with 2 labels and a button to retrieve the 10 numbers and put them in the list box then the other button puts the highest and lowest number in the 2 labels

Note: Place them in 2 diff sub-routines.

Option Strict Off
Option Explicit On
Public Class Form1

[code]....

The only issue i have is to get the smallest number to show up.. mine just keeps showing "Zero".

View 4 Replies

Getting Largest And Smallest Number From An Array And Placing In 2 Dif

Nov 2, 2010

I have the code written for everything except when I try to display the highest and smallest numbers from the array into a label it display 0 for both the smallest and highest number. Question: Create an application that lets the user enter 10 values into an array. The application should display the largest and smallest values stored in the array. *The form is a list box with 2 labels and a button to retrieve the 10 numbers and put them in the list box then the other button puts the highest and lowest number in the 2 labels

(I am not sure how to display line numbers in my code on VB2010, please if you know tell me and I will edit the post)

[Code]...

View 8 Replies

Grab The Smallest Number, Of The 2 Inputted Numbers?

Mar 18, 2010

I'm making a program for a class, as usual. I need it to grab the smallest number, of the 2 inputted numbers.Well, there is 4 inputted numbers. For instance the user inputs the following:

Price Ounces
20 4
12 4

I divide the numbers, and get 5 and 3.The better buy is going to be item 2, as it is $3 per ounce.But I need the program to grab the smallest number AFTER dividing, and then display that in a label. I need to know how to grab the smallest number. What statement do I use?Odds are, it's something simple and I'm overlooking it.

View 9 Replies

Two Labels To Determine Smallest And Largest Number

Apr 8, 2009

I have 2 labels. One needs to show me the lowest number of the 10 in my rich text box and the other needs to show me the largest.

Public Class Form1
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Me.Close()
End Sub
[Code] .....

View 14 Replies

Find The Smallest Number From A Text File List?

Aug 13, 2009

The program is about a text file that contains the sizes of eggs. They task is to put each egg size into a category e.g. small, large, xLarge etc. Also i need to record the highest and lowest weighted egg.

I have don everything except find the lowest weight. Not matter what i try, i cannot seem to keep hold of the lowest sized egg.

here is my code :

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim egg, jE, exE, lE, medE, sE, tE, high, low As Double

[Code]....

View 7 Replies

Math.min - Find Smallest Number Typed By User In Text Box 1

May 3, 2011

I have two text boxes on my form. text box 1 allows a user to type in a number (decimal) and text box 2 will display the smallest number typed in so far. The idea is to find the smallest number typed in by the user in text box 1, by using the Math.min method to compare each number typed in by the user to a variable that contains the smallest number to the point. Then replace the variable value with the smaller of the two numbers. To make it work for the first number. I have to initialize the variable to 99999. (no if else statements should be used).

View 3 Replies

Put Date From Datagridview In Word Table From The Smallest To The Largest Number?

Jan 19, 2012

My datagrid view looks like this :When I put the table to fill in word,my report looks like the table below, but I want my rank days are arranged from smallest to largest as in the table below :

Cod for filling

in the table word I use this:

Dim Tabela3 As Word.Table = WordDoc.Tables.Add(WordDoc.Bookmarks.Item("endofdoc").Range, DataGridView2.RowCount, 6)
Tabela3.Range.ParagraphFormat.SpaceAfter = 0
Tabela3.Columns.Item(1).Width = WordApp.MillimetersToPoints(33.3)

[code]....

View 1 Replies

Getting "0" As The Smallest Number Stuck?

Oct 26, 2011

'Make variable declarations for inputs from user

Dim inumber1 As Integer
Dim inumber2 As Integer
Dim inumber3 As Integer
Dim inumber4 As Integer
Dim inumber5 As Integer

[Code]...

View 1 Replies

Finding The Place Value Of A Number?

Sep 20, 2009

How would I find the place value of a number?

View 7 Replies

Finding The Small Integer Number

Aug 14, 2009

i'm dave mark.. im new to vb 2008.. i just have to have some question.. the problem is i have to input 10 integer number then after inputting the 10 number .. it will compute the sum, average and the smallest.. i have no problem with sum and average but in smallest number only... how to get the smallest number>>?

View 1 Replies

Finding The Lowest Number From A Data File?

Jun 13, 2009

I am taking a VB2008 class and I have the entire program figured out except for one thing. I've checked our text I've scoured the internet and I've tried tons of things.

What this section of code does is access a data file, calculate the average from it... done.. that works, calculates the highest number in it... done that works... and calculate the lowest number from the file... nope... not working. I've tried tons of things and what i have in there now keeps giving me an output of 0, when it should be a 2.

Private Sub btnCalc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalc.Click
'Calculates average, minimum, and maximum temperatures from data file
Dim month As String

[Code]....

View 2 Replies

Datagridview/Query - Finding Highest Number And Assigning It To A Variable?

Jan 9, 2010

I don't know if I worded this properly, but I have a mdb query that I display in a Datagrid on my form. The first column is TransactionNumber, which is the primary key and a running total (ex. RackingTransactionKey=RackingTransactionKey + 1). What I need to do is when the form is opened, find the highest (last) TransactionNumber from the query or Datagrid and assign it to a variable (RackingTransactionKey), so I can can update it (+1), therefore generating a unique number so I can add data to the query.

[Code]...

View 13 Replies

Finding A Method Check The Number Of Records In Data Reader?

Jun 22, 2010

is there a method check the number of records in data reader? like the count of rows. ?

View 2 Replies

Finding The Page Number Of A Matched String In A Word File?

Jun 7, 2011

I am not an ardent developer in vb.net programming. But off late I am using vb.net to develop a windows application.

The following is what I am trying to do:

I am reading an excel file and storing the string value present in each cell, and trying to match the string in a word file.

The program works fine except that I am having problems in returning the page numbers of the matched string.

The page number value is always returned as one.

The following is a piece of what I had written:

If FindStringInFile(wordfilename, vValues) Then
currentPageNumber = word.ActiveDocument.ActiveWindow.Selection.Range.Information(Microsoft.Office.Interop.Word.WdInformation.wdActiveEndAdjustedPageNumber)
TextBox3.Text = currentPageNumber
End If

wordfilename is my word file and vValues is my excel string data

View 1 Replies

Drawing Dotted Path Lines With Evenly Spaced Dots?

Apr 22, 2012

I have a problem drawing dotted path lines, with evenly spaced dots: I want to be able to draw evenly spaced dots along a path line using points in an array, My issue is not with drawing the path line, with dotted lines, this is easy, but with the spacing of the dots at the start and end of the path line.

In the example I have created, I create a square with 4 points and draw a dotted path.The path starts at the top left corner and finishes back at the top left corner, the dots are evenly placed along the path, except the final dots at the end of the path. (Sometimes the dots are even and other times they are not even).The shapes I want to draw can be any size and any shape, but I have used a square in this example to show the problem I have.I have also attached two pictures showing the dotted path line, 1 with even spaced dots at the start / End and another showing the problem I want to resolve, with not evenly spaced dots at the start / end.The only difference between the two is the point values.

View 1 Replies

Check If X Is Divisible By 5?

Mar 30, 2009

I'm trying to check if when x is divisible by 5 then it makes y true.

basically: if x / 5 = "positive integer" then y = true.....

how do you check if a number is divisible by 5?

View 7 Replies

Count And Add All Numbers That Are Divisible By 2,3?

Apr 13, 2011

i need to count and add all numbers that are divisible by 2,3 and 5 inclusively ( the answer is 30, 60, 90 sum is 180). I tried running a loop and a true false isnumber. what am i doing wrong? all i have is two textboxes and a button Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

[Code]...

View 6 Replies

VB Loop Minimum Sum And Divisible?

Nov 19, 2009

I have run into a snag in my loop program. I was able to figure out the maxium sum and average of the sum. But am not able to figure out how to:

1) List the minimum value

2) List the sum of the numers divisible by 5.

These are the numbers.text displayed:

5
15
6

[Code].....

View 1 Replies

Finding Physical Drive Number Using Drive Letter?

Jun 16, 2009

I have a program that allows the user to enter a drive letter into a text box. The program then takes the letter and find the physical drive number (i.e. deviceharddisk3..). It then stripes out everything and leaves me with the number 3.

In VB6 I used mDrive.bas from vbAccelerator.com and it worked perfectly. I have been all over the internet and back and cannot find a solution written in VB.NET.

View 14 Replies

Getting The Largest, Smallest And Average Value?

Jul 19, 2011

My problem is I have a program that needs to input 3 values in 1 textbox only. I've been trying to figure that out for a couple of days now.this program must show the largest, smallest and average of 3 values.

Public Class Form2
Dim array() As Integer = New Integer() {a, b, c}
Dim a, b, c As Integer

[code]....

View 5 Replies

10 Textboxes Numeric Values (SMALLEST)

Apr 26, 2012

if i have 10 textboxes on my form with numbers inside 5 of them have the number "0" other 5 lets say 100 50 40 30 10 i need to get the smallest value but not the "0".

View 2 Replies







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