User Must Enter A Number Between 1 And 100?
Sep 26, 2009
How do I make it that the user must enter a number between 1 and 100? And If they dont they get an OK messagebox stating that they must do.I imagine it'll be something like this:
If TextBox1.Text = "" Then
MessageBox.Show("You must enter a value between 1 and 100", "Name Entry Error", _
MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
End If
But Im not sure whats suppose to go inbetween the speech marks.
View 4 Replies
ADVERTISEMENT
Oct 4, 2009
I am supposed to create a program in my VB.net class to do the following:
1. Prompt the user to enter the beginning number and the ending number.
2. Find the sum of the even numbers between these two values, inclusive.
[Code]...
We are currently using for next statements in the class. I know how to prompt for and utilize the numbers that are input etc. My problem is the EVEN numbers part. I obviously have to determine if the number is even and then use a step value of 2 from there. But not sure how to determine if number is even or odd (guessing to use mod, but totally lost).
View 8 Replies
Mar 2, 2011
I am wounder if anyone might have a web site or no where I can find the information so I understand how to prompt the user to enter the beginning number and the ending number. And then to find the sum of the even number. Now does anyone know what a name convention is ? I have tried to look it up on the forums but cant find nothing on it.
View 9 Replies
Mar 12, 2012
If IsNumeric(Hundreds.Text) Then
HundredsTotal.Text = (CDec(Hundreds.Text) * 100).ToString("##,##0.00")
DollarAmtVar = CDec(HundredsTotal.Text)
[CODE]..
The above code is from a small program I have written. This test is done on about 30 textboxes I am using for the user to enter number.
The following is the sub routine that is called.
Sub ShowError()
MessageBox.Show(BoxName & " must be a number.")
End Sub
Here is what I want to do but it won't work.
BoxName.Select()
This is so I can put the focus on the different boxes that might contain an error.
View 4 Replies
Jun 10, 2011
program that allows the user to enter a month and a number of years. (e.g March and 10 years) The program then displays all the months of the year from the entered month in a loop that runs as many times as the number of years.(e.g March April May.....December January February March....)
View 1 Replies
Oct 5, 2011
I need to create a small application that will force a user to enter an even number but i MUST use a loop. Here's what i've come up with:
Quote:
Dim bynombrepair As Byte
bynombrepair = InputBox("Entrez un nombre pair")
If bynombrepair Mod 2 = 0 Then
[Code]....
View 1 Replies
Apr 16, 2012
i'm having a bit of a hard time on setting up the calculations.There are three seating categories at a stadium. For a baseball game, Class A seats cost $15, Class B seats cost $12, and Class C seats cost $9. Create an application that allows the user to enter the number of tickets sold for each class and the total revenue.
View 3 Replies
Mar 21, 2010
I need to code a basic multiplication table in VB. I need a popup input box to ask the user to enter a number, then a label to display the multiplication table for that number from 1 to 9.
[Code]...
View 5 Replies
Mar 24, 2010
I have a program for class that requires you to have the user enter the number of days they wish to save for and then the program takes 1 penny and doubles every day for the amount of days the person enters. I was able to get this to work in Raptor but not VB.
'Description: Taking one penny and doubling it over the number of days the user enters.
Dim decPennies As Decimal = 0
Dim intTotaldays As Integer = 0
[CODE]...
View 3 Replies
Dec 10, 2010
I need designing a Windows based computer program that will allow a user to enter some number (n) and a choice of a count up or count down for that many numbers. So for example, the user enters 5 as their number and selects the count down option, the message box displayed would contain the message: "Here are your numbers: 5,4,3,2,1,0"
View 7 Replies
Aug 25, 2009
How to write a if else statement to check if the number user enter follow within a range.
View 5 Replies
Oct 28, 2009
Create an application that allows the user to select or enter into a combo box the number of days a person will work, and calculates the total amount of pay she will receive over that period of time. Salary is one penny the first day, two pennies the second day, four pennies the third say, and continuing to double each day.
The combo box must list the following items: 30, 180, 365, and 1000. Must be the default drop down box. Use a validating event procedure on the combo box.
The program should go through a loop once for each day, doubling the number of pennies with each iteration of the loop. You will need a running totl of the number of pennies that you add to with each iteration. To calculate the total amount of pay, multiply the total number of pennies by .01 and show the result in currency format.
Public Class Form1
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
[CODE]...
View 14 Replies
Jul 7, 2011
Create a program which promps the user to enter an unlimited number of test scores. The program should show the high score and the low score. You should use a loop of your choice within this program. The program should look similar to the one below:
View 3 Replies
Feb 22, 2009
how to create an error message by message box to tell the user to enter a number only if they key in a character value?
I MEAN AFTER THEY PRESS THE CALCULATE BUTTON
Private Sub btnCalcFat_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalcFat.Click
Dim intFat As Integer
intFat = Integer.Parse(txtFat.Text)
lblResultDisplay.Text = txtFat.Text * 9
End Sub
My text box is call txtFat
View 3 Replies
Dec 10, 2010
designing a Windows based computer program that will allow a user to enter some number (n) and a choice of a count up or count down for that many numbers. So for example, the user enters 5 as their number and selects the count down option, the message box displayed would contain the message: "Here are your numbers: 5,4,3,2,1,0"
View 14 Replies
Oct 11, 2009
Heres my code for my button:
Private Sub btnTotavrg_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTotavrg.Click
'Calculate the average and total of the entered marks
Dim num1 As Integer
Dim num2 As Integer
[code]....
How do I make it that when a user dosent enter a number between 1 and 100 in the textboxes; an OK messagebox comes up telling them to?
1. I want to have the messagebox come up after the button is clicked and not under a leave event.
2. And its also important to make sure that if any non-number is entered; it wont crash.
View 1 Replies
Nov 30, 2010
It seems like I'm only able to enter a certain number of chars into a textbox.Like if I have a list from 1 to 10000.When I paste it in a textbox it ends like this:
5639
5640
5641
[code]....
Why cant I add everything to the textbox?
View 9 Replies
Nov 16, 2011
Basicly my instructor said that we have to make a program that will count how many times we enter a number into an inputbox, he also said we had to use a while loop. [code]
View 4 Replies
Mar 31, 2011
With this code, I am trying to enter a number in TxtBox Class A, B, and C. When I place a number in either text box, it will multiply the following text boxes by either 15, 21, and 9, add the total and place it in the the total text box. When I run the code I get this error message "Conversion from string "" to type 'Decimal' is not valid."
Dim decClassA As Decimal
Dim decClassB As Decimal
Dim decClassC As Decimal
Dim decClassAR As Decimal
Dim decClassBR As Decimal
[Code] .....
View 2 Replies
Feb 7, 2009
I am trying to release my program now and I have a quick (hopefully quick) question concerning serial numbers. I want to be able to store the trial serial number so if the user uninstalls and reinstalls they won't get another evaluation period free of charge. My concern is that some crafty person will simply move the database files in and out of those installs and keep going indefinately. Although I have some protections built into the database itself in case the program runs out, I just want one extra layer of protection. Is there a way to store the serial number in the registry when entered and check for that entry whenever the program is installed using Windows Installer 3.1?
View 2 Replies
Nov 9, 2009
I am attempting to create a game in Visual Studio 2008 that allows a user 10 attempts to guess a random number between 1 and 50. I have a label box in which I would like to display the remaining guesses as they decrement. The code so far appears below.
My two (I am sure very basic) questions are:
1. How would I pass the random integer generated through the Generate Integer function to the AmIRight button's click function? I was trying to decrement the counter each time the "Am I Right " button is pressed.
2. I would also like to evaluate each "guess" when the "Am I right button is pressed. Is it possible to nest a Select Case statement in a For Next Loop?
vb.net Option Explicit OnOption Strict OnOption Infer Off Public Class frmMain Private Sub btnExit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnExit.Click Me.Close() End Sub Private Sub txtGuess_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles
[CODE]...
View 3 Replies
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
Feb 15, 2012
I am trying to draw textboxes when the user enters the amount of textboxes to be drawn on one form and the textboxes get displayed on the another form. I have found these codes online but it works with inbuilt codes I guess. That is, the number is already hard coded in the form.
[Code]...
View 10 Replies
Nov 4, 2008
I am trying to create a lotto simulation, but don't know how to continue.I am using numericupdowns to allow users to select 6 lotto numbers. and labels to display what they have chosen, but i'm not sure how to prevent duplicates without creating a large number of If statementsMy question is, is there an easier way to prevent duplicates without writing a bunch of if statements?here is my code:
Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim Lotto1, Lotto2, Lotto3, Lotto4, Lotto5, Lotto6 As Single Lotto1 = Val(NumericUpDown1.Text) lblLotto1.Text = Lotto1 Lotto2 = Val(NumericUpDown2.Text) lblLotto2.Text = Lotto2 Lotto3 = Val(NumericUpDown3.Text)
[code]....
I don't understand how to save the user selected numbers, let the computer generate 6 random numbers, and match the two sets of numbers together to see how many matches there are. As far as I understand the numbers should be stored in 2 separate arrays and then matched together to find any matches.
View 4 Replies
Jan 27, 2012
I want to be able to enter (type in) data into a combobox as well as picking from the list. In earlier VB there was AfterUpdate event so that I could enter in the data I wanted. Now I have tried Keypress, Enter, and others and they all want just one character or number. If I try to enter a two-digit number it doesn't wait.
View 16 Replies
Jan 1, 2011
So I would like an email program that within the code already has the from email adress, gmail. I would like it to let you enter the number of emails to send to the address that you enter, not the one in the code. Also I would like it to be able to enter the message.
View 2 Replies
Nov 22, 2010
I am doing a program for travel reservation and need to know how to let the customer enter their passport number into a textbox. Its is 8 characters long and the first 7 characters are numbers and the 8th is a letter.
View 1 Replies
Oct 15, 2011
how can i limit a user to enter 10 digit no like telephone no in textbox without using regular expressions?
View 12 Replies
Oct 9, 2011
how can i limit a user to enter just 10 digit number (minimum 8 but not more than that 10 in any case) in a textbox(like telephone no)?
View 4 Replies
Apr 28, 2012
So I wanted to make a program for math where you enter a number into a box. Then you click enter. The program has numbers 1-12 next to a check box. If you click enter it divides your number by the numbers 1-12. Let's say you put 100 in that box. Then you clicked enter. The check box next to ten would be checked, 4, 2, and 5 would all be checked because those numbers evenly go into 100. How can I have the vb check to see if the sum is a whole number?
View 1 Replies