VB Program That Requests A Positive Integer As Input?

Nov 28, 2009

i did this much but something doesn't seem right...the question is A Visual Basic program that requests a positive integer as input, and carries out the following steps:If the number is even, divide it by 2.Otherwise, multiply the number by 3, and add 1 to the result. Repeat this process with the resulting number, and continue repeating until the number 1 is reached.After the number 1 is reached, displayed how many iterations were required to reach the number 1. (Hint: a number is even if number Mod 2 = 0.)

Private Sub btn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn.Click
Dim num, multiply, divide As Double

[Code]...

View 4 Replies


ADVERTISEMENT

Write A Program To Request Positive Numbers One At A Time From The User In An Input Dialog Box

May 12, 2009

I'm currently in VB class at my highschool and we just got chapter 6.1 to read on this online textbook that we follow. Anyway, we are doing loops now and the problem reads "Write a program to request positive numbers one at a time from the user in an input dialog box. The user should be instructed to enter -1 after all the positive numbers have been supplied. At that time, the program should display the sum of the numbers." So far I know this much

[Code]...

Now I know this isn't right But I can't find out how I'd pull out the numbers the user entered to get the sum of them and not include -1 because as it stands, when I hit ENTER with -1 the label just shows -1.

View 22 Replies

Output Divisors Of A Positive Integer?

Aug 30, 2009

how I could go about doing it. The console application needs to input a positive integer and output its proper divisors.

[Code]...

View 17 Replies

Show Positive Symbol For Integer?

Feb 15, 2009

How do I have a positive number show the "+" sign before the number.

I feel that this should be easy but my searches must be too broad because I get way more info than I want and don't seem to find the easy fix.

View 3 Replies

Test An Integer Value To See When It Is Positive / Negative?

Sep 18, 2009

I am looking for a way to test an integer value to see if it is positive or negative so I can perform the required actions.

View 1 Replies

Develop An Application Which Accepts A Positive Integer Value From The User?

Nov 8, 2011

develop an application which accepts a positive integer value from the user and outputs the sum of all integers between 0 and the given integer.

View 7 Replies

Simple Script To Output Divisors Of A Positive Integer

Aug 30, 2009

The console application needs to input a positive integer and output its proper divisors.[code]

View 2 Replies

Asp.net - Big Negative Number - Positive Giving Positive Only?

Apr 15, 2011

I have temp2 value -52340.0 and hslColor.Luminosity is 240.0 When Dim temp1 As Double = (hslColor.Luminosity - temp2). It shoud give -ve number but I am getting always positive number. results should nbe -52100, but I am getting +52100. How to handle this?

View 4 Replies

Write A Program That Requests A Word Containing The Two Letters?

May 25, 2009

(Write a program that requests a word containing the two letters r and n as input and determines which of the two letters appears first. If the word does not contain both of the letters, the program should so advise the user.)I got the program to work but he said its wrong because we need to have it looping and if one of the letters is missing you also have to say which one is missing.I have some of the pseudo code but I don't know how to make it work.If Index of("R") = 0 or index of ("N") = 0 Find out which is missing and display message.Else Find larger and display message.

[code]...

View 1 Replies

Let Textbox1 Only Enter Positive Whole Numbers And Positive Decimal Numbers?

Jan 10, 2012

How to let textbox1 only enter positive whole numbers and positive decimal numbers

View 4 Replies

VS 2005 - Make A Program Intercept And Stop Certain Write Requests?

Sep 1, 2009

Is it possible to make a program intercept and stop certain write requests? I need it to stop viruses from tampering with an antivirus database. If you can, how do you do it? If not, is there another way to stop viruses from changing the database?

View 39 Replies

Write A Program That Requests A Name From The User And Insert The Name Into The List In Its Proper Location?

Oct 1, 2010

Write a program that requests a name fomr the user and insert the name into the list in its proper location, if the name is already in the list, the name should not be inserted. --do not use any arrays or LINQ use only streamreader/streamwriter.What i've got is this...it will add the name but not in the "proper location". if i could use an array i'd just reorder the array and then write to file, but...

Imports System.IO
Public Class Project_3a_p398
'Purpose: A program that requests a name from the user

[code].....

View 1 Replies

VS 2008 Program Requests A Password If Its False It Returns Noturous 'failed To Login'

Feb 15, 2010

I'm trying to compare something the user sends to a listview(first column) to see if it can find a match using [code] and if it equals true the program requests a password if its false it returns the noturous "failed to login"

View 2 Replies

Convert Textbox Input To Integer

Mar 14, 2012

I'm using VB 2010. What is the best way to convert a textbox to an integer?

View 11 Replies

Input A String Or Integer Into Another Exe's Textbox?

Aug 18, 2009

Is there a easy way to input a string or integer into another exe's textbox for example, if i wanted to write into the textbox on the windows calculator '3'.

View 1 Replies

Calculate An Average From A Input Integer Within A Loop?

Feb 11, 2009

I'm looking for a way to calculate an average from a input integer within a loop. When the user enters something like -90, the average will be calculated using the previously input numbers.

View 4 Replies

When The Button Is Pressed It Will Check Whether The Input Is Integer

Sep 8, 2009

i need to take input in text box that will be integer. when the button is press it will check whether the input is integer.

can i do this using isNumeric Function?how?

View 4 Replies

Dynamic GridView - Insure The Input For The Textboxes Is An Integer

Dec 17, 2009

I have a web page with 5 checkboxes and 2 textboxes per checkbox. When the user checks one or more checkboxes the corresponding textboxes become enalbed for UI. I need to insure that the input for the textboxes is an integer-that I will do with a validators. There is a gridView on the same page. When the user checks one or more checkboxes the 2 columns of the gridView rows become active for input through enabled textboxes.

There are 4 columns in the grid. The minimum number of rows enabled are 2 and the maximum are 26. The UI for the grid's textbox input is numbers. Those numbers have to be equal to or less than the total. How do I validate UI of numbers(integers) into the grid's dynamically generated textboxes and then add the total and compare it to the alloted total? I prefer to do this with the code behind - using VB.NET - rather than with ASP.NET or absolutely not javascript.

View 1 Replies

Make Text Editor Handle "Set As Default Program" Requests?

Jun 2, 2010

I was wondering how to make my Text Editor handle "Set As Default Program" requests, and have files saved default-ly open with it. For example creating my own file type.I don't know if this is possible in VB.net

View 1 Replies

Change This Checksum Function To Accept An Integer Input Instead Of A String?

Dec 31, 2009

This function doesn't work if I change the input argument 'pdu' from a string to an int.Would someone please help me figure out what to do here so that the checksum does not add the ascii value of the int argument but rather the actual integer value?I took out a few lines of the actual function but it adds the input argument to a packet sent out via TCP protocol.This function shows the integer value just fine in the string that gets encoded as a byte array. the checksum is wrong.!

''Public Function buildpacket(pdu As Integer) is what I want.
Public Function buildpacket(pdu As String)
Dim packet As String

[code]....

View 1 Replies

Program - Requests A High Number And A Low Number From User - Searches Array And Finds All Elements Within Two Numbers

Jan 24, 2010

I need to write a program that requests a high number and a low number from the user, then the program searches the array and finds all elements within the two numbers. The program is used to search for past presidents, so if I type 43 for low number and 44 for high number, the program will display:

George Walker Bush
Barack Hussein Obama

I think I have an idea of how to search up to a certain point, but not to stop at a certain point....Here is the code that I have for that particular sub procedure:

Quote:

Private Sub btnDisplayRqst_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDisplayRqst.Click
Dim sr As IO.StreamReader = IO.File.OpenText("PRESIDENTS.TXT")

[CODE]...

View 4 Replies

Input Any Words In Textbox - The Program Will Reply By Sound Of What Input In The Textbox

Jul 7, 2009

i use visual basic 6 i already try making a button to play sounds. by clicking the button and the sound will out. so that i want to know were could i start, when you input words in textbox the program will speak what you have type in the textbox.
_

View 5 Replies

Either End The Program Or Start The Program Over In A Visual Basic Console Application - Based Upon User Input?

Apr 8, 2012

I have a procedure at the end of my console application that ask the user to either hit enter to end the program, or type s to perform another search. The issue I'm having is no matter what the user types in the program end. What I would like to happen is if the user types s, then the program starts over and lets the user perform another search. The program is procedural and I need to find a way to start back off at the top of the program which ask the user to type a name to search.

[Code]....

View 1 Replies

Show Textbox Input In MsgBox Error! Conversion From String "Tabii" To Type 'Integer' Is Not Valid?

Feb 19, 2012

The project I'm working on is a Multichoice RadioButton quiz with answers and percentintegers. At the end there is a MsgBox that gives the number of answers counted 'correct'and the percent 'correct'. Also after you press the confirm button on that MsgBox it emails the results to the built in information given on the SMTP information. What I am trying to do now is show the input typed into the textbox on FormA in the MsgBox at the very end.

View 3 Replies

Get An IntPtr Pointing To An Integer In Program?

Jul 29, 2009

I need to get the address of an integer and assign it to an IntPtr to use in an API.[code]...

View 3 Replies

Convert Negative Integers To Positive Ones?

Jun 22, 2011

I need to convert a negative integer to a positive one.

View 14 Replies

Convert Positive/negative Number?

Dec 19, 2005

Is there a built-in function in .NET (VB) to convert a negative number into a positive, and vice-versa?I usually end up just using:NegNum = PosNu - (PosNum * 2)PosNum = NegNum- (NegNum * 2)

View 6 Replies

Disable In Textbox Has Anything Else Besides Whole Positive Integers?

Jun 12, 2009

For the life of me, I cant seem to do this. In the textbox_textchanged method, I want Button to disable in textbox has anything else besides whole positive integers.If text box has positive integers, i want button1 to enable.

View 6 Replies

Positive Decimal In Datagridview Columns?

Jun 1, 2011

How to set in datagridview column to force it only accept positive decimal value??

If negative , then raise dataerror event??

View 4 Replies

Round To Half, Always In Positive Direction?

Aug 25, 2011

How do I achieve the below rounding?

0.012608376 > 0.015
2.1 > 2.5
2.4 > 2.5

[code].....

View 3 Replies







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