Only Allowing Integers To Be Inputted In A Calculator?
Mar 24, 2011
How do I only allow integers to be entered when coding for a calculator in Visual Basic 2008 while allowing real numbers to be displayed as the result of a calculation?I thought I had come up with the solution but I think I may have made a mistake in my coding...
Public Class Form1
Private Sub GroupBox1_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GroupBox1.Enter
End Sub
[code]....
View 4 Replies
ADVERTISEMENT
Jul 14, 2011
I am using an oleDb connection to connect to an excel spreadsheet (.xlsx) file and load the information into a datagridview. From there I hope to have it edited by a person and programmatically at runtime. However, I noticed that when I import a file that has integers in a column, it will not import any of the string values in that column. Also, It will not allow me to manually enter strings into that column at runtime - it results in an error stating: [Code]
View 16 Replies
Mar 20, 2010
I tried coding for an application that will display the positive integers, negative integers and zero entered in a inputBox. for some reason it keeps crashing down.here is my code. paging all visual basic professionals. [code]
View 6 Replies
Feb 2, 2012
Basically I have and array of integers that vary in size. I need to compare each number to each other number and display which number is repeated. For example:
Dim ints() As Integer = {1,2,2,5,4,6}
The number that shows up more than once is 2.
How can I run through the array and compare each integer with the numbers in the array. I tried a for loop but it didn't return the value I was looking for.
View 3 Replies
Oct 26, 2009
I'm trying too have values inputted through a text box, and then have the program calculate how much the person will earn in their working life.
Dim Name As String
Dim Salary, Total, Raise As Double
Dim Age, Retire, Count As Integer
[code]....
However, whenever i click the button to calculate, it gives me how much he would have earned after 1 year with 1 raise, but i can't see what i'm missing.
View 8 Replies
Sep 9, 2009
I'm working on a console application in VB .net that checks a number that the user has inputted, and tells you whether the number is prime.
The number that has to be inputted has to be between 1 and 100. I have all the code so far and at the moment it can check whether the number is or isn't within the boundries.
View 4 Replies
Dec 5, 2010
I am in Visual basic 2010 express.The user will input how big the array dimensions will be.
An inputbox will appear asking the user to type each row in the array.
How do use substrings to separate that string in into each box in the array. (probably separated by commas or spaces?)
View 3 Replies
May 13, 2010
how am i going to check if the directory that was inputted in the textbox is a correct directory?
View 2 Replies
Sep 13, 2010
I am a beginner at VB.net programming. this score calculator. The application is suppose to total up a sum of numbers added, show the count, and an average of the numbers inputted. I try using an array to store the inputted values. Now I'm have issues with my loop keeping track of the total. Also, how do I clear out the array to start over?
[Code]...
View 1 Replies
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
Jul 25, 2010
I have created a program in Visual basic 2010, the program contains many different objects e.g. datagridview, textbox, buttons, graphs etc, which can all be modified by the user. The user can also select a file using 'SaveFileDialog'.
Is there a way to save all the properties associated with each object to this file and later load the program back to exactly the same state it was saved in, after the user has selected saved file using 'LoadFileDialog'? Preferably in binary.
I can do this the hard way in ASC11 format by interrogating objects user editable properties and saving them. I would rather not use this method as it will require a lot of code and any future program changes will require a lot of extra work.
View 3 Replies
Aug 9, 2009
I have created a program in Visual basic 2010, the program contains many different objects e.g. datagridview, textbox, buttons, graphs etc, which can all be modified by the user. The user can also select a file using 'SaveFileDialog'.
Is there a way to save all the properties associated with each object to this file and later load the program back to exactly the same state it was saved in, after the user has selected saved file using 'LoadFileDialog'? Preferably in binary.I can do this the hard way in ASC11 format by interrogating objects user editable properties and saving them. I would rather not use this method as it will require a lot of code and any future program changes will require a lot of extra work.
View 2 Replies
Mar 31, 2011
I have to write an application that has the user input data in 3 separate text-boxes and press "OK" to save it. The user can repeat this as many times as they want.I then need the application to show the information inputted in each of the 3 separate arrays. Now I was told this can either be done by using a print page or by having another form show the information. I was told having another form would work best. I guess my question(s) are: is it possible to show the information from all 3 arrays in another form? Also, is there a link to any code that can help me out in listing information from a
View 7 Replies
Apr 13, 2011
I have created a sample program that dynamically created up to 7 numbers of Labels and Text Boxes. Here I want to add those numbers inputted by user on dynamically created text boxes.
Dim WithEvents TxtBox As TextBox
Dim WithEvents LblLabel As Label
Dim NoOfControl As Integer
Dim A As Integer
[code]....
View 6 Replies
Jan 8, 2012
I have been assigned a task to create a basic hangman program and I need help to figure out how to show the letters that the user has guessed correctly without displaying any of the other Characters.The word that the user will be guessing is in a label the user will be guessing letters by clicking buttons This is a piece of the code for one of the buttons the user can click to guess the letter "C":
btnc.Visible = False
Guessletter = "C"
If lblword.Text.Contains("C") Then
*this is the part where I become stuck*
End If
View 6 Replies
May 13, 2009
I have a NumericUpDown control with a range of 10-50 and I want to have the selected number be multiplied by an amount of money to create yearly cost. I dont know, however, how to use inputted data from the NumericUpDown control in a statement because I cannot convert it to Integer and I also dont know how to call in the data even if a number is selected.
View 3 Replies
Feb 28, 2009
Simple requirement to split a double value inputted into a string to decimal and fractional.I enter 12.1 and it splits it into
12 and then 0.0999999999999996
Where is my 0.0000000000000004 gone??? Did the cpu tax it?I have tried a few other tricks to split the number and i get the same result...The fractional results of each attempt
12.0 0 Amazing!!!!
12.1 0.0999999999999996
12.2 0.199999999999999
[code]....
View 6 Replies
Oct 20, 2009
I'm making a program and was wondering if someone could please help me (its a console app) to display words from a string that the user has inputted starting with certain characters?
View 7 Replies
Sep 30, 2009
how do I get the program to check if the inputted word has ascending alphabetical letters
Public Class frmAlphabetical
Private Sub btnPress_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPress.Click
[Code].....
View 4 Replies
Mar 28, 2011
i'm a freshman and was handed this assignment a short while ago and i'm having extreme difficulty figuring out why i keep getting the following error message whenever i click btnGenerate.Click on the form:Error1: Unable to apply this change while debugging. 'Private Sub GroupBox1_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GroupBox1.Enter' was deleted that modifies 'Public Class Form1'. You must revert the change or stop the debugging sessionBasically the assignment is requesting that we build a 'Call Cost Calculator' and since im relatively new to this i've never worked with strings before and also get the follow errors:Warning2Variable 'sCountryBeingPhoned' is used before it has been assigned a value. A null reference exception could result at runtime.Warning3Variable 'sPhonePlan' is used before it has been assigned a value. A null reference exception could result at runtime.
My form codes:
vb
Public Class Form1 'heading Const sFormHeading As String = "Call Cost
[code]....
I reals because it's driving me mad and i'm honestly quite literally stuck and can't move on until i get this sorted.
View 5 Replies
Mar 10, 2009
I want to write a program in vb.net that measures the frequency of sound inputted from microphone. What kind of ideas can you offer
View 1 Replies
Aug 19, 2011
I'm making a VB.net application. I have a dialog that pops up at some points. It is set as TopMost. The problem is, when it pops up, you can't move the main form. How can I make it so it shows and is usable while allowing the main form to continue to be usable?
View 1 Replies
Sep 16, 2011
I'm supposed to write a program that validates an inputted ten digit ISBN number using the check-digit at the end to ensure that the sum is a multiple of eleven. Before calculating this and detecting if the entered number is indeed a valid ISBN, we're required to check the first nine digits and see if they are indeed integers. After this the tenth digit is checked to see if it is "X" (for ten) or 0-9.
With the code I've written it keeps returning false for whether or not the ISBN is valid, even with valid numbers. I feel like its something to do with the hyphens; have I misused the replace function?I'm a little lost on how to make my code work, but I'm fairly certain my logic is okay so far.
[Code]...
View 4 Replies
Aug 1, 2009
I currently have a list of words in a text file sorted in to alphabetical order and put into lower case, but I would like to be able to also display the line numbers on which these words are associated with.. but only one instance of.
For example,
"This is a random text
file that I
have just made
up this second"
[Code].....
As you can see above, I would like to show that "this" for example appears on line 1 and 4. Hopefully tabbed so that it keeps a nice look to it.
View 1 Replies
Sep 12, 2010
UPDATED: Feel like this shouldn't be that complicated, but I think I just don't know the proper name for what I'm trying to do. I'm dealing with an ASP.net project. The concept is pretty simple: I have a library that supplies some ecomm functions. One class in the libary contains functions around calculating tax. One class in the library revolves around the cart header. This class is consumed by a web project.
[Code]...
View 4 Replies
Jun 21, 2010
I coded my textbox to be only type in numeric numbers. But the backspace doesn't work when I run the program anymore, Can't delete what has typed in the textbox.
Here is my code
Private Sub AmountTextBox_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles AmoutTextBox.KeyPress
Dim allowedChars As String = "0123456789"
[code]....
View 2 Replies
Jun 25, 2010
I am creating a converter program (lengths, weights and such), basically just for the learning process because I still find myself very new to this.Well it's like this, I have a textbox where the user is supposed to write the value of the unit he/she wants to convert. As we all know there is a possibility to write in many weird strings which the program later on result in a big error. I recently managed to get rid of dots, because the program couldn't convert if there were a dot among the numbers "." (commas "," works great!). And now there are other types of errors I need to get fixed. I will make a short numeric list.
1. I wonder if it's possible to make dots "." to mean the same thing as a comma ",".
2. I also wonder if i could disable letters a-z or like -#@%&]?! and so on, i just want the basic 0-9 with a coma or dot.
3. I tried to make a Msgbox that tells the user when he/she has done an overflow, a number to big for the program to handle, for example [Observe the code is also trying to prevent the user from writing a minus "-":
(textbox1_textchanged)
If TextBox1.Text.Contains("-") Then
TextBox1.Text = TextBox1.Text.Replace("-", "")
[code]....
The minus thingy works great, but the 9999999... code, it always creates problems so I have commented it out for now until I know how to handle it.
4. Even though I got rid of the dot "." problem, the user is still able to write more then one comma, and I also want to get rid of that. The code I use right now for the "disable dot problem" is:
(textbox1_keypress)
If e.KeyChar = "," Then
If TextBox1.Text.IndexOf(",") > -1 Then
[code]....
View 9 Replies
Apr 17, 2010
I can't find a basic thing: how to enable a picturebox to be dragged inside a form? I'd need to be able to drop it inside a listbox so that listbox would get the picturebox's name-value in it. But I'm having trouble even getting started.
View 4 Replies
Nov 3, 2009
I have a textbox and I need to restrict entry to only the letters A-Z , a-z and the space key. I know I need to use something like
If (Microsoft.VisualBasic.Asc(e.KeyChar) < 65) _
Or (Microsoft.VisualBasic.Asc(e.KeyChar) > 90) etc
with an e.handled at the end
View 3 Replies
Jul 15, 2009
i would like to allow the user to play around with the size of the trackbar in vb.net. is there an easy way to do this?
View 1 Replies