Homework - Write A Program To Print Only Even Numbers Between 6 And 16 Using Events
May 22, 2011
I was given an assignment to "write a program to print only even numbers between 6 and 16 using events", but I don't even know where to begin. The main thing I am having difficulty with understanding in this assignment is how I am supposed to specify that it only print even numbers in the given range of numbers.
Am I going to have to do a Mod2 code for each individual number and have it exclude any with the result of 1? Or is there another piece of code specifically designed for such an occassion? Perhaps there is some type of equation I can have the program read in terms of a variable, which holds the values of 6, 8, 10, 12, 14, and 16? I am just genuinely confused on how this is supposed to be programmed.
View 3 Replies
ADVERTISEMENT
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
Jun 13, 2011
i m trying to write a program that displays in a textbox a table of the binary, octal, and hexadecimal equivalents of the decimal numbers in range 1-222.
View 3 Replies
Mar 6, 2011
I have just about completed a .NET project to write a program to randomly select numbers for a Bingo caller. Over the last month or so Ive learned a lot about .NET but heres something that I consider to be odd and maybe one of you guys can offer an opinion.
One of the features of calling Bingo in a small local club is that callers often use little sayings to accompany certain numbers, I expect youve all heard of (say) All the sixes, clickety click for 66 or 5 and 9 the Brighton line for 59 etc. My little program gives an option to incorporate these with a prompt for the caller that can be edited outside of the program. One of these conventional sayings is used when a number is reversed 12 followed by 21 or 45 followed by 54 for example, when the caller might call (say) 1 and 2, one dozen, number 12 And the other way round 2 and 1, twenty one.
So, I programmed in a bit of code to detect this and to over-ride whatever might otherwise have been the quote with And the other way round and set about testing it. Ive been through literally dozens of full 90 calls watching for the occurrence of a reversed number, spent a few hours doing it, and not once has it occurred which is to say the least, unusual.
So, Im wondering about the Rand Function, could it be that it isnt possible for a reversed number to be selected? Just so you know, I randomly pre-select the order of all 90 numbers, I fill each of the 90 elements of an array with a random number first checking that the number selected hasnt already been stored, if it has, I just get the next random number (and check that too of course), but I cant see how that could prevent reversed numbers being selected, especially in light of the fact that frequently it's not the 'next' number that's used.
View 39 Replies
Jun 4, 2012
I'm trying to make a program that will calculate the sum of consecutive numbers between two given numbers. [code]
View 13 Replies
Sep 2, 2009
how to write a program that uses a Do while statement and a For ..... Next statement to print the numbers from 1 TO 10 step 3
View 2 Replies
Jul 11, 2009
I have noticed that when I use drawstring to only print numbers, it just prints nothing. However if I put a letter in the string, it prints. So, "12345" will not work, however
"a12345" will work.
Example:
Dim g As Graphics = e.Graphics
g.DrawString("12345", myFont, getBrush(Color), X, Y)
View 3 Replies
Jul 11, 2009
I have noticed that when I use drawstring to only print numbers, it just prints nothing. However if I put a letter in the string, it prints.
[Code]...
View 16 Replies
Nov 5, 2009
I am trying to learn about arrays and the for next..loop. This is a noob question but I cant seem to get it to work. I am trying to load an array with 30 numbers that print to a list box.
Dim a(29) As Integer
Dim strVar As String = "{0,-5}{1,5}{2,5){3,5}{4,5}"
Dim x As Integer
[Code].....
For some reason I keep getting errors in the output statement that says "Input string was not in a correct format."
The output should list 1 to 30 in the list box
View 5 Replies
Jan 8, 2010
i want to make the addition of two numbers and to see the result during i write them no button click
View 21 Replies
Apr 24, 2012
I am looking to print invioce numbers on stationary. So, for example, the invoice number is located in cell I1 of the excel spread sheet and starts at 100600. I want to print 150 invoices with the invoice number going up by 1 in each increment. So, I have thus far written:
[Code]...
What i need to achieve as you can now see is that the macro picks up the invoice number and does this however many times (or however many invoices I want to print.
View 7 Replies
Jun 13, 2011
I am trying something new and that is VB2008. I have two numbers 12 and 15. I have made my form but now I need to make the code. I need to make a code that takes two numbers 12 and 15 and gets the max number out of those two numbers, which is 15.
View 2 Replies
Dec 13, 2011
I used this code to prevent write letters in TextBox only numbers. but I couldn't use the backspace key . how can I use it with this code
vb
Private Sub txtTelN_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtTelN.KeyPress
If Char.IsNumber(e.KeyChar) = False Then e.Handled = True
End Sub
View 2 Replies
Aug 22, 2011
I'm making a simple little program. It's going to save the image in the clipboard (from pressing Print Screen) to the folder that the .exe is in. My problem is trying to find out how to save the image file with a user-specified name, such as "Image", then adding numbers to it. So it would be like Image_00001, Image_00002, etc. I would like to make the name be specified using a textbox (pretty easy). I know how to get it to save as different image formats and all, and I know how to get it to save as a hardcoded name in a hardcoded location, but that it isn't what I'm aiming for. If you've ever used the screenshot function of Fraps or MSI Afterburner, then that's basically what I'm trying to make here.
I've already searched these forums and did some Googling, but couldn't find anything that I was looking for. Not even a sample program with something like this. I found something in the CodeBank, but it's all the stuff I've already gotten implemented.
[Code]...
View 8 Replies
Mar 29, 2010
i had generated some data in gridview and i had write it to a text file. I found that it is very difficult to align the data in a tabular form in text file. I had tried to put vbtab in the string and it appears perfectly in text file. However, when i wanted to print the text file, there are no spaces appear in the string. How can i make the write and print data in a tabular form perfectly in the text file perfectly?Anyone have any idea?
View 2 Replies
Feb 18, 2011
Basically wat i'm trying to do is continuously write numbers from 1 to 10000 using 1 thread & stop this using another thread. But it doesn't seem to happen.
I have pasted the code for your reference.
Imports System.Threading.Thread
Imports System.Threading
Public Class Form1
[Code].....
View 3 Replies
Jan 10, 2010
I have one textbox and one label i want to see the distances between the numbers imediately when i write them example 1476=365-32-1
View 39 Replies
Dec 14, 2010
In need to write the number 7.2 in a table field. What type the field needs to be. And what type needs the variable to be?
View 1 Replies
Nov 16, 2011
Can we write all the control events in a seperate class file in different layer rather than in code-behind of web-page ?
View 1 Replies
Mar 11, 2010
Write a function to print the Fibonacci value at a given position in the series.you should write two versions of the function both of wich must be named Fibonacci(overload functions).the first version should be implemented using a for loop.the second version should be implemented using do until.
View 3 Replies
May 24, 2010
What is missing is a way that when I give a print click on the quantity of copies informed skirt with sequential numbers without repetition
[Code]...
View 1 Replies
Jun 26, 2010
I want to open a txt file and write into it numbers from 1 to 100 and put between every number enter.
View 4 Replies
Mar 8, 2009
I know how to declare a variable, a function, to write a string of characters or numbers (I still looking in tutorials and depict from there what i need to know) but...WHAT I DONT KNOW is how to USE them? At "what" or "how" are you thinking when you make a program? I try for SOME LOooNG TIME to understand but I think im too stupid to understand from pages on the net (or i dont find THAT tutorial who can explain right for me).I try a lot of programing languages starting with pascal,c,c++,darkbasic,alice, Visual-c,c#,c++,basic,php,even assembler, some programing zones in Excel and Word but from all of this i cant manage to understand the life behind the words.
View 1 Replies
Jun 16, 2009
Iam trying to write code that read integer numbers from user (intered in form) and put it in array and then i will do some calcuation.I declare The array z and index of array p at begining of the class (global), I dont specify the size of arry couz that it depend on user.
If CInt(l1.Text) >= 0 Then
z(p) = CInt(l1.Text.ToUpper)
l1.Clear()
l1.Focus()
[Code]...
View 11 Replies
Sep 14, 2010
I want to write a program to write in an xml file in this format:
<?xml version="1.0" encoding="utf-8" ?>
- <Orders>
<Item id="1" SKU="998123" Description="Super Widget" Quantity="100" />
[Code]....
View 2 Replies
Jan 17, 2012
So...numeric sorts. Do I really need to write a custom comparer to make a listbox full of numbers sort itself like:
[Code]...
View 4 Replies
Sep 13, 2011
EDIT: Solved (see comments) I have a For loop inside a sub, and right below it I have a MessageBox function. Everything compiles correctly, however for some reason, if the loop executes and exits successfully, anything outside and below the For doesn't get executed.
[Code]...
it displays only 10 items in the ListBox afterwards. I've searched everywhere, but I did not find anything related to such an issue. I'm kinda puzzled, anyone got a clue of what's going on? EDIT: Forgot to specify, the sub is actually a TextBox.TextChanged event
View 1 Replies
Feb 16, 2011
So my teacher gave us this assignment that I'm having trouble understanding why she wants us to write outside of the button Private Sub.1. Write the code for the Calculate Total and Grand Total button a. Declare a variable to accumulate the individual totals outside the sub procedures b. Calculate the total by multiplying the selected number of atendees by the selected cost, and display this total in the label next to Total c. Calculate the grand total by adding the total calculated in step 3.b to the grand total variable. Display the grand total next to Grand Total I'm don't understand why she says 1a. I feel like you can just write all the variables in the same Sub on the calculate button.
View 8 Replies
Oct 26, 2009
Have to develop an application that will let me choose between cell phone plans, individual and family plans i have the forms and all choices done,. new forms open and old ones hide to keep it clean. i think i got all the variables declared, and got no debugging errors, but when i select the options, it always gives me the following:
1. adds one more phone than selected
2. only shows phone subtotal, tax and total
3. prices for options and monthly fees never show
Here is my code for all 3 forms
Public Class frmMain
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
End
End Sub
[code]....
View 9 Replies
Jun 29, 2011
I am developing an ASPX VB.NET file. My assignment is to convert an integer representing week of the year into that end date. For example, if user selects Week 4 for 2011, I want to get date = 1/22/11. How do I do this in VB.NET?
View 2 Replies