Hey, So basically I'm making a program that can convert feet to metres, it would ask for the start value, increment and end value, before displaying the results in the Listbox.

Example;

Start = 1 foot
Increment = 1 foot
End = 5 foot

Foot Metres
1 **
2 **
3 **
4 **
5 **

I have finished all my designing of it, but just having problems figuring out how to do this (Very new to VB), I will be doing a course in VB soon at my local College in Washington and I got recommended to try make some programs before I start, I have made a calculator and a very basic time converter.

So yeah if anyone can help that would be great!

so you want the code to populate the ListBox only right?

listBox1.Items.Add("Whatever");

if you want more help please post what you done so far.

Comments
Always helpful!

so you want the code to populate the ListBox only right?

listBox1.Items.Add("Whatever");

if you want more help please post what you done so far.

Well I want to populate the list box with the converted units as I have shown above, I have only done design for it, no coding as I dont know where to start.

Well I want to populate the list box with the converted units as I have shown above, I have only done design for it, no coding as I dont know where to start.

That's not help. That would be doing your homework for you.
Read the forum rules. You need to show effort, and what better way than posting the code that you have tried so far?

We only give homework help to those who show effort

Ok so this is basically where you pick whether you want a table or single value converted, you also pick the unit you want to convert from and to.

When you click table, it brings up this form, where you choose how you want the table to appear and to how many decimal places, Currently I need help with making the table know what unit it is and what it is converting too, I dont know if this is asking for too much help, if it is just ignore me and I will go on my way lol.

Attachments q.jpg 23.33 KB

for what you want to do.

Didn't you read the rules? we ain't doing your homework for you. We will however help you if you are stuck during the work.

You have to show an effort mate. Designing the UI is not difficult especially in VB

Feel free to delete this thread

You are not asking for help. You are saying please do it for me. That would be doing your homework for you. Read the forum rules. You need to show effort, and what better way than posting the code that you have tried so far?

Comon A4L you have to understand we want what's best for you.

What we want to do is let you learn how to do it, so you can teach others on this forum. If we just tell you the answer, the likeliness that you will try to understand that code is rather low. it's not that we don't trust you, we don't know you, but we look at ourself when we make such a call.

We ask ourselves if we were in your shoes would we try and understand what the answer meant if someone just gave it to us.

--------------------------------------------------------------------------
if someone doesn't agree please neg me, I feel strongly about what I said. I would like to know the opinions on this matter.

So i figured out something more basic that I need some help with, When I select something from my comboBox off the main off, say Grams to Ounces, How would I make it so that when I open the Single Value form it applies the certain calculation to the convert button. Does it have to do with me making an array? so like grams to ounces is (1) in the array and that tells the program to apply the calculation to convert button when the single value form is opened.

Does that make any sense? Can I get any help just a little?

Because I need to write the structured english for the subtask that opens the secondary form (Single Value) and which type of conversion(grams to ounces)

Edited 6 Years Ago by American_4_Life: Adding info

Not sure what you mean.

Are you saying you enter a value and then choose from a combobox the conversion type. So when you click the button the conversion occurs?

If this the case all you need to do is have an if statement to check which item in the combobox is selected

comboBox1.SelectedIndex == 0

0 being the first item from the top, 1 being the second from the the top and so on.

I don't see the need for an array if you are only giving it one input.

Hey thanks for the help, Well I mean when Im on the main form, you pick the conversion type you want to make from the combobox then you click Single Value which loads you to the Single Value form which is where you put in the value you want to convert.


I understand the code you have given me Finito, but when the program knows I have the first item selected "0" which is convert grams to ounces, how do I tell the program to apply that specific equation? Would I need to make a "if" statement, like if combobox = 0, apply (grams to ounces calculation) to the Single Value form where I Click convert.

Sorry if some of this doesnt make sense, I'm trying my best.

Logic,If comboBox1.SelectedIndex = 0 Then
apply calculation, whatever number is in the "Convert number" textbox * 0.035 (Grams to Ounces) to convert button on Form Single value.

Now i know this isn't correctly written but this is what I want to happen.

or

If comboBox1.SelectedIndex = 0 Then
Convert Button(on the single value form) = whatever is in the "Convert number" textbox * 0.035

Else

If comboBox1.SelectedIndex = 1 Then
Convert Button(On the single value form) = whatever is in the "convert number" textbox * 28.35 {Ounces to Grams}

Edited 6 Years Ago by American_4_Life: add

Ok Disregard my last two posts, I think I figured out to use the Select Case for my multiple choices between which conversion I wish to do.

when you click the button do this

Label1.Text = double.Parse(textBox1.Text) * 28.35 + "";

I am sorry I just saw an error in my code

it should be

if (comboBox1.SelectedIndex [B]==[/B] 0 )

Edited 6 Years Ago by finito: n/a

This article has been dead for over six months. Start a new discussion instead.