This exercise says :"Write a program that inputs one number consisting of five digits from the user, separates the number into its individual digits and prints the digits separated from one another by three spaces each. For example, if the user types the number 42339, the program should print 4 2 3 3 9 Use the command window for input and output. [Hint: This exercise is possible with the techniques discussed in this chapter. You will need to use both division and modulous operations go "pick off" each digit.]"
This exercise I have yet to start, and don't think I will be able to do much, because I have no clue how to "Pick off" the numbers using division and modulous operators. I know what the mod operator does, but I do not know how to use it and division to do what this exercise is asking me to do.
Write a program to calculate the average of three exam marks. The input and output should be done by subprograms GetMarks and DisplayAverage respectively. the calculation should be done by a function, CalcAverage. This is my code:
Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click Dim student As String, exam1 As Integer, exam2 As Integer, exam3 As Integer Dim average As Double lstResult.Items.Clear()
A parking garage charges a $2 min. fee to park for up to three hours.The garage charges an additional 50 cent per hour for each hour or part thereof in excess of three hours. The max charge for any given 24-hour period is $10. Assume that no car parks for longer than 24 hours at a time. Write a program that calculates and displays the parking charges for each customer who parkes a car in this garage yesterday. You should enter in a TextBox the hours parked for each customer. The program should display the charge for the current customer. THe program should ise the method CalculateCharges to determine the charge for each customer. Ise the techniques described in the chapter to read Double value fro a TextBox. [ You may need to use methods Convert.ToDouble and Convert.ToDecimal when doing calculations with the number of hours and charges]
Public Class ParkingGarageFeeCalculatorForm Private Sub calculateButton_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles calculateButton.Click Dim hoursParked As Double = Convert.ToDouble(hoursParkedTextBox.Text)
I've been working for several days on a GUI where a lot of individual data elements need to be displayed side-by-side and wrap to the next line when they overflow; the goal is to not have to explicitly design an individual 'row' element with a set number of elements for this purpose. The FlowLayoutPanel seems great, except...
I need to be able to determine how many elements are on each line (dividing the width of the control by a predetermined value indicating width of child controls does not work); I need to be able to determine how many elements will be on each line (I may need to put 4 elements on line 1, then auto-wrap, then 8 elements on line 2, then auto-wrap, then as many elements as can fit on line 3 before autowrap, then 16 elements on line 4, etc); and finally I'd really like to put a 'line header' at the left margin and a 'line footer' at the right margin, where for example the line header contains a line number and the line footer contains the number of elements on that line.
I have a form that has 10 addition execises. The user has the option of using a timer or not. I have the timer part correct, but now I want to be able to check the exercise answer one by one as the user inputs the info.
I have a form with 10 math questions. Beside each question there will appear a check mark if it is right and a X if its wrong. I also have a label that will display a score in percentage. If 2 are right then it will display 20%. If they are all right then it displays 100%. My problem is ...how can I code the event. I thought of case select, but that would mean 100 cases to make it work.( If check1 and check2 are visible then display 20%, but if its check1 and check 7? Thats alot) What I want ot know if there is an easier or shoter way to ontain the same result. I am working with Visual Basic 2008.
I got a problem with my calculation .The problem is after addition and subtraction calculation I only get result or answer 0, .There are not a correct answer. I try to change the datatype of the variable to decimal and double but answer is still 0.
Here is my coding. Private Sub btnadditionprice_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnadditionprice.Click Dim sum6, sum9 As Decimal sum6 = Val(Me.ItemPriceTextBox.Text) + Val(Me.txtadditionprice.Text) [Code] ..... Answer which got is 0.000
I have made my calculator and it has 2 textboxes where the 2 numbers (or values go for addition and subtraction) are input and a label where the answer appears. There is other things on the page such as quit, clear etc thats all done but i have one query. I noticed while testing a problem occurs when only one number or value is put into a textbox and a command is hit. For example. one textbox (txtnumber1) has one number in it then i hit multiply and it says the error of course because its not programmed to deal with this (or divide by 0 of course) so i was wondering how i could make so when this happens a MsgBox appears saying a value must be in both boxes or when divded by zero is says something similar.
The line of code:
Private Sub blah blah blah...
If txtnumber1.Text = False Then MsgBox("Please Input Valid Value")
I need to create a tiny calculator using the basic operators of Addition, Subtraction, Multiplication, and Division. My professor hasn't really covered much of this, so I'm not to sure how to create it.
I'm writing a program for my algebra students to practice integers.Stuff like....
3-6 -4 + (-5) 3(-4) -15 ï¿½ 3 etc.
I want to show an explanation and for the addition and subtraction, I want to show it on a number line. For example, if the problem is 3 - 7, the number line should show and arrow to that goes right to 3, and then left 7 units (starting from 3). Then the student can see that the answer is -4.I could probably do this with some string manipulation, but what would be the easiest way to do it in a picture format? Maybe a bitmap.
In my "Select" statement I have this: Int((Date()-dob)/365.25) AS Age I would like to do the same thing in VB .NET code. I plan to do something like: editBoxAge.Text = ....... dob would be stored in datePickerDob.Text
Below is my code in randomizing numbers in vb 2010 express edition. Error comes out stating that "AppendText is not declared. It may be inaccessible due to its protection level"..
Private Sub BtnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnAdd.Click Dim x As Integer Randomize() For x = 0 To 8 TextBox1 = AppendText(Str(Int(Rnd() * 10))) Next [Code] .....
I am creating a hangman game for a class prject. I have done everything apart from randomising the word that is loaded in. I have tried a few different types of code but just can't seem to get it. I have tried this:
Basically I have two textboxes. Textbox1: "(Hey|Hi|Yo)! My name is (John|Linda|Carl)" Textbox2: Blank
What I want to do is to press a button and transfer the contents of Textbox1 to Textbox2. However, I want it to randomize the result by randomly selecting between the words in the parentheses. Now of course, the contents of Textbox1 are subject to change at any time, so I can't just add code for "Hey", "Hi" and "Yo". I need some sort of system in place that will generate random results no matter what I put in Textbox1. So I guess I have to search the string for "(", note the location and then search for "|" to isolate the characters in between as one word or phrase. Then search for ")" to determine the end of the randomizing and continuing normally until the next "(".
This is in ASP.net iwth VB.I have a quiz project that I've been assigned for work.This quiz project contains two main SQL Databases it pulls the info from. First is a Quiz table, which contains three columns: QuizID (Pri Key), Title, Description. This is where I declare the quizzes, indicated by the QuizID (1, 2, 3....etc)
The second table is the Questions table, containing the following columns: QuestionsID (Pri Key), Title, Answer1, Answer2, Answer3, Answer4, Answer5, CorrectAnswer, QuestionOrder, QuizID....The QuizID in the Quesitons table matches the QuizID in the Quiz table.Thus for QuizID = 1, it consists of all the questions with the matching QuizID in the Questions table. The CorrectAnswer I want to assign a simple value (1, 2, 3...etc).I need a way to take a set of questions (based on the QuizID) put them in some sort of table and randomize them (or rather shuffle them) so that each time this quiz is taken, it pulls all questions randomly, but not repeating any)...I then want the code to pull the question and coorepsonding answers to pick from in a radiobuttonlist. However, It only needs to pull the number of answers. Example, a True/False will only have Answer1 and Answer2. The other Answers will have the NULL value in it.
There needs to then be a way to go through each one of these questions that have been placed in the table (in that random order) using a "next" button. When a question and possible answwers are displayed, I alaready have code to keep the answers in the session to grade it at the end (using correctAnswer and selected answer.I have no specific way to bind the data to the Database. I have used SQLDataSource to make other connections before, but I don't know if this is the best way.
randomizing picturebox location given four points example:i have 4 picture boxes. these boxes should be place at points (145, 190) (210, 190) (290, 190) (37, 190). this will display the pictureboxes at a horizontal line. i'm adding a functionality that when i press spacebar or click a button, these coordinates will be randomized and be assigned to my four pictureboxes just like in text twist but no animations.
i'm working on a simple 3D CAD to create complex 3D objects. This application uses:
1. Direct3D to render the objects 2.The methods contained in the Mesh class (such as Mesh.Box(...)) to create them 3.The Matrix class to apply some basic transformations (such as Translation or Rotation)
My issue is to do a boolean subtraction of a Mesh to another one to create a more complex Mesh, for example a Mesh with holes.
i am creating here coding which use to substract number in database from textbox. In my coding i use textbox which receive number from user and it will subtract a number in database. For your info i am using UPDATE sql command for this operation . In the same time i also create table name InItem and have column name Itemquantity After i click the button i got an error InvalidOperationException was unhandled from my coding Here is my coding and please correct my coding if it have missing part. I also highlight which code give this error. Oh ya , is that my sql command for subtraction is correct? i also not sure cause it get it from internet.If my command if false please show me with correct command..
I have a piece of code that reads in lines of tabbed text. It is a game of who wants to be a millionaire. What I would like to do is get the game to incorporate random questioning. The format of the text file is as follows:
Which record company did the Beatles create? (tab)Apple Records (tab)Sony (tab)BMG (tab)LiteFM (tab)Apple Records (tab) Which has the highest mountain? (tab)Mars (tab)Ireland (tab)Iceland (tab)America (tab)Mars(tab) With a set amount of lines. I want the program to choose each question randomly and not to repeat the question. I'm not sure how to incorporate it into the code.
i am creating here coding which use to substract number in database from textbox. In my coding i use textbox which receive number from user and it will subtract a number in database. For your info i am using UPDATE sql command for this operation . In the same time i also create table name InItem and have column name Itemquantity After i click the button i got an error InvalidOperationException was unhandled from my coding Here is my coding and correct my coding if it have missing part. I also highlight which code give this error. Oh ya , is that my sql command for subtraction is correct? i also not sure cause it get it from internet.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim ra As Integer
i have some problem for developing the code for addtion of 3x3 matrix class the code which i have develop is given below. but this class is not executed in vb.net code. dont know whats getting wrong in it as m nt getting the required result. in correcting the code as m new in vb.net.
I have a project where I want to have checked arithmetic by default, except for one performance sensitive spot. Unfortunately, VB.Net doesn't have an 'unchecked' block.Ideally the framework would have some sort of integer type with explicitly unchecked arithmetic, but I didn't find anything like that. I did find that expression trees have binary expressions for unchecked operations, but the delegate overhead cancels out the unchecked advantage (and then some).
Currently I'm converting the inputs to UInt64/Int64 before doing the arithmetic, then converting back (with a bitwise And to ensure in-range). It's about 50% slower than unchecked arithmetic (according to profiling).
Moving the arithmetic-sensitive part to a project with unchecked arithmetic might work, but it seems like overkill to give it an assembly all to itself.
Alright I have my assignment to the bottom, and my code so far in CODE mark up.I'm trying to get a value in a textbox assigned to a variable (Price) add to a variable (Subtotal), clear out the textbox and loop around. I looked for hours in my book and google and couldn't find m
Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load