|
-
Jan 31st, 2013, 07:58 PM
#1
Thread Starter
Junior Member
-
Jan 31st, 2013, 08:38 PM
#2
Re: A small program
You mention you are using Visual Studios 2012 but which language VB or C#?
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
https://get.cryptobrowser.site/30/4111672
-
Jan 31st, 2013, 08:47 PM
#3
Thread Starter
Junior Member
Re: A small program
i need to use Visual Basic as a language for that program
-
Feb 1st, 2013, 05:46 AM
#4
Re: A small program
Moved from General Discussion / Chit Chat
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Feb 1st, 2013, 11:16 AM
#5
Re: A small program
So A B & C would be textboxes ... and the other numbers & symbols would be labels... just add as many as you need and place them accordingly.
-tg
-
Feb 1st, 2013, 11:28 AM
#6
Re: A small program
You actually drew out the design fairly well. The rectangles may all be textboxes. The + and = signs would have to be in labels. You may also want a, b, and c to be labels, as well. Generally, a textbox is a place where a user can type something, but for a, b, and c, you don't really want the user to be able to type anything, right? If they are not allowed to edit the numbers in those boxes, then you should use labels rather than textboxes. In either case, fiddle around with the font, backcolor, forecolor, appearance, and borders to make them look the way you want.
Behind the scenes, you'd want three variables (possibly called a, b, and c) of type Double. Those would hold the values. Thus you might write:
Dim a As Double = 0.15
Dim b As Double = 0.5
Dim c As Double = 0.3
you would show these variables in the textboxes/labels with something like this:
<your control name here>.Text = a.ToString
<your next control name here>.Text = b.ToString
<your next control name here>.Text = c.ToString
What happens after that isn't so clear, though, as I'm not sure what step you would want the user to take next. Do they enter a value for the total and press a button?
My usual boring signature: Nothing
 
-
Feb 2nd, 2013, 10:32 AM
#7
Thread Starter
Junior Member
Re: A small program
 Originally Posted by Shaggy Hiker
You actually drew out the design fairly well. The rectangles may all be textboxes. The + and = signs would have to be in labels. You may also want a, b, and c to be labels, as well. Generally, a textbox is a place where a user can type something, but for a, b, and c, you don't really want the user to be able to type anything, right? If they are not allowed to edit the numbers in those boxes, then you should use labels rather than textboxes. In either case, fiddle around with the font, backcolor, forecolor, appearance, and borders to make them look the way you want.
Behind the scenes, you'd want three variables (possibly called a, b, and c) of type Double. Those would hold the values. Thus you might write:
Dim a As Double = 0.15
Dim b As Double = 0.5
Dim c As Double = 0.3
you would show these variables in the textboxes/labels with something like this:
<your control name here>.Text = a.ToString
<your next control name here>.Text = b.ToString
<your next control name here>.Text = c.ToString
What happens after that isn't so clear, though, as I'm not sure what step you would want the user to take next. Do they enter a value for the total and press a button?
@ Shaggy Hiker , first of all Thanks for your answer!
1. In this program i want the user to type any numbers (double nymbers) for a, b ,c and
2. there isn't other steps in this program., just this three number to give us one total. but as you say propably i need one button to do this. right ?
Thanks again for your time you and other people spend for me, i appreciate that
-
Feb 2nd, 2013, 12:09 PM
#8
Re: A small program
 Originally Posted by HyDrageN
@ Shaggy Hiker , first of all Thanks for your answer!
1. In this program i want the user to type any numbers (double nymbers) for a, b ,c and
2. there isn't other steps in this program., just this three number to give us one total. but as you say propably i need one button to do this. right ?
Thanks again for your time you and other people spend for me, i appreciate that
I would highly recommend using NumericUpDown controls instead of TextBoxes for allowing the user to type in numeric input
-
Feb 2nd, 2013, 07:46 PM
#9
Re: A small program
I agree on the numeric up down, since that would restrict the entry to just numbers. You would need to be sure to set the max, min, and step properties to reasonable values.
A button is pretty much essential. There is an alternative, but it is a pretty miserable one in practice. There are = buttons on calculators for a reason: You have to know when the user is done entering stuff. You have the same motivation. Technically, you could perform the calculations on every ValueChanged event for the controls, which would actually work fairly well, in this case, but it would mean that you would have a new value every time you changed any number in any way, and the value would be 0 until you had entered something into every box.
My usual boring signature: Nothing
 
-
Feb 2nd, 2013, 09:23 PM
#10
Thread Starter
Junior Member
Re: A small program
TextBox4.Text = TextBox1.Text * 0.15 + TextBox2.Text * 0.5 + TextBox3.Text * 0.3
4 Textboxes and 1 Button was all the program.
Can anyone tell me how to Calculate Double numbers ? when i type 5.6 6.7 8.4 the program is not calculating right.. is working only with integer numbers :/
-
Feb 3rd, 2013, 01:47 AM
#11
Re: A small program
 Originally Posted by HyDrageN
TextBox4.Text = TextBox1.Text * 0.15 + TextBox2.Text * 0.5 + TextBox3.Text * 0.3
4 Textboxes and 1 Button was all the program.
Can anyone tell me how to Calculate Double numbers ? when i type 5.6 6.7 8.4 the program is not calculating right.. is working only with integer numbers :/
NumericUpDown control
.Minimum = Decimal.MinValue
.Maximum = Decimal.MaxValue
.DecimalPlaces = 1
.InterceptArrowKeys = True
When they click the button, simply grab the NumericUpDown's Value property and you're set.
-
Feb 3rd, 2013, 11:11 AM
#12
Re: A small program
What you have should work ok, as long as certain bad conditions are met:
1) You have Option Strict OFF.
2) Nobody ever leaves a textbox blank, or otherwise enters something that can't be fully converted to a Double.
Those are bad conditions, though. The NumericUpDown would remove those concerns, in which case the button click event would look like this:
TextBox4.Text = (NumericUpDown1.Value * 0.15 + NumericUpDown2.Value * 0.5 + NumericUpDown3.Value * 0.3).ToString
My usual boring signature: Nothing
 
-
Feb 3rd, 2013, 11:25 AM
#13
Thread Starter
Junior Member
Re: A small program
 Originally Posted by Shaggy Hiker
What you have should work ok, as long as certain bad conditions are met:
1) You have Option Strict OFF.
2) Nobody ever leaves a textbox blank, or otherwise enters something that can't be fully converted to a Double.
Those are bad conditions, though. The NumericUpDown would remove those concerns, in which case the button click event would look like this:
TextBox4.Text = (NumericUpDown1.Value * 0.15 + NumericUpDown2.Value * 0.5 + NumericUpDown3.Value * 0.3).ToString
sorry guys i started using Visual Basic 5 days now
i don't know how it is work,
you have right but i don't know how to do all this staff that's why i started this topic for little help from professionals 
JuggaloBrotha he wrote to me this program and thanks for his time
Thanks to all
-
Feb 4th, 2013, 07:58 AM
#14
Fanatic Member
Re: A small program
Don't be disappointed HyDragen... Start your work and search the internet resource, you will get so many things, but if not, then come over here.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|