473,498 Members | 1,671 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Multiplay text box entry with predifined number

10 New Member
Hello :)
I have started using Visual Basic Express 2008 today, but I kind of feel I am not getting even the basics running..
I'd like to do the following:
I have a textbox and a button which I would like to use as the submit button. I'd just like to be able to add a value in the text box and by clicking on the calculate button it should show me the result of a multiplication by 0,5
If someone could help me with this and how to make that work, i'd much appreciate it!
Mar 20 '11 #1
5 1891
debasisdas
8,127 Recognized Expert Expert
Why not read some books to learn the basics of the language.
Mar 20 '11 #2
Guido Geurs
767 Recognized Expert Contributor
Private Sub Command1_Click()
Text1.Text = Val(Text1.Text) * 0.5
End Sub
Mar 20 '11 #3
Alkis Arxontas
10 New Member
Thanks for your answer! :)
I actually searched and figured out

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

If TextBox1.Text = "" Then
MessageBox.Show("Please insert a value.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
Else
Dim a As String
a = TextBox1.Text
Label2.Text = Math.Round(a * 0.5)
End If
End Sub

How can I add Mathround to
Text1.Text = Val(Text1.Text) * 0.5
because your code seems to be better and cleaner than mine?
Mar 22 '11 #4
Guido Geurs
767 Recognized Expert Contributor
Expand|Select|Wrap|Line Numbers
  1. If TextBox1.Text = "" Then
  2.    MessageBox.Show("Please insert a value.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
  3. Else
  4.    Label2.Text = Math.Round(Val(TextBox1.Text) * 0.5)
  5. End If
Mar 22 '11 #5
Alkis Arxontas
10 New Member
Perfect! Thanks a lot! :)
Mar 22 '11 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

3
11138
by: Homer Simpson | last post by:
How do I convert a value in a textbox to a real number so I can perform some math ops on it? I understand I will need to validate the textbox's input to make sure it is a real number and not a...
1
1959
by: utabintarbo | last post by:
Is there a native Win32 text entry dialog available through the Win32 extensions. I am looking for something similar to easygui's (http://www.ferg.org/easygui/) enterbox. Any ideas? TIA
2
1646
by: Andy Mabbett | last post by:
Although I only speak English, I need to learn techniques for publishing text using non-European scripts (initially Urdu & Punjabi). I think I'm getting there, but I'm having problems finding...
6
24128
by: ivan.perak | last post by:
Hello, im a beginner in VB.NET... The thing i would like to do is as it follows.... I have a text file (list of names, every name to the next line) which is about 350000 lines long. I would...
6
1426
by: Chad | last post by:
I have a simple little program that brings up asks the user to enter a note, then is supposed to place that note into a text file when the user hits the submit button. However, when the user hits...
1
1407
by: mthuywin | last post by:
Hi guys I would like to develop an application that tracks all the text input in windows (including those in MS Office apps and in IM clients) and translates them into another language. I plan...
1
2201
by: oravm | last post by:
I am developing a tool for predictive text entry for sms on a mobile phone. The language used is J2ME and RMS database. Please guide me on the following:- 1) The relevant references or websites...
13
10480
by: v13tn1g | last post by:
so basically my GUI window has 4 text entries where the user inputs stuff. i have created a clear button with in my window, the thing that i was wondering is how do i create a function to associate...
3
5760
by: rhen18 | last post by:
Hi everyone. I am creating a basic chat interface in Glade that contains only 3 widgets namely Text View, Text Entry and Button. Like I said, it is very basic. However I am having a problem with...
2
15938
Thekid
by: Thekid | last post by:
I have a toplevel window in tkinter that has some entry fields. Is there a way that I can get it to change the letters typed in it to uppercase, either as they're typed or after they're typed, while...
0
7126
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7005
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7168
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7210
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5465
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4916
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4595
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
1
659
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
293
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.