Is anyone good at Visual Basic?

The friendliest place on the web for anyone that follows U2.
If you have answers, please help by responding to the unanswered posts.

u2elevatejo

The Fly
Joined
May 8, 2002
Messages
110
Location
UK
.. because I'm not and I'm worried I'm going to fail my course on some crusty programming that I can't do.

Heeelllpp meeeeee!

lol - STRESS!!

I need to make a conversion program which can convert bi-directionally (whatever that means).

What I have to convert:

Fahrenheit to Celsius
Feet to Metres
Gallons to Litres

I'm also crap at maths. We only get our programming lesson once a week for an hour and a half. We've had 4 weeks to learn how to use visual basics and we're suddenly expected to write our own program! Now I've missed the lesson to do with Pascal (screams) so God knows how I'm going to pass the course.

I took Multimedia not programming!!!! Narghhhh!!

:scream:

Jo
 
I dont have enough time to really help you.....but from my experience with programming classes like that(especially my VB class) usually a project that is given is discussed in the book somewhere(if you have one).

To be quick cause I'm at work.....What I would do first is go over any chapters you may have talked about in class. 95% of the time in my education there were a lot of "clues" on how to figure a program out just by skimming through a chapter or two. it won't give you the full answer(though it may...), but it will give you enough of a idea to get started.


If I were anywhere else but work, I'd let you email me the project so I could help more....

sorry:drool:
 
It's your lucky day- I majored in CS. I can help you out a little- what language are you writing in, C or C++? or Pascal? I studied Pascal but that was in high school. if you post all the info here i'll see what I can assist you with. But off the top of my head you will want to do something like this:

have an IF statement based on a user input to see what they want to convert. For instance, ask them what they want to convert, enter T for temperature, W for weight, S for size (or something like that) and store that in a variable. if variable = T then you want to convert from Farenheit to Celc. I need more info- like do they enter in the temperature? you'll need another promopt after that- it's actually a hard problem for students who aren't very familiar with the language- my frist problem was something like, make a program that prints out your name!

anyway let me know how I can help. :) a good idea is to write out what the problem wants to do step by step in English and then figure out how to translate each step to cs language
 
Last edited:
Thanks for the tips so far. I'm using the Visual Basic software, drop and drag type stuff where we just fill in the code, actions etc..

A friend said this code would help:

Function F2C(sngF As Single) As Single
f2c = (sngf-32)*5/9
End Function

Function C2F(sngC As Single) As Single
c2f = 32 + sngc*9/5
End Function

Function F2M(sngF As Single) As Single
f2m = sngf * 0.3012
End Function

Function M2F(sngM As Single) As Single
m2f = sngm / 0.3012
End Function

This all rings a bell. I'll have to look through some of the notes I've taken. The thing that annoys me is that we did some quite complex coding but we only copied it from a book or the board.. we didn't actually 'work it out' which is why I'm having problems writing my own!

Basically, all it says in the requirements is:

A conversion program is to be written which can convert, bi-directionally:

(all that stuff I listed before)

The interface should be clear, simple and easy to use. The program must reject inappropriate input and notify the user.

Helpful huh.

I'm looking through all the material I was given and it's really not helping. I have until Friday so I'm going to have a good read tonight and see if I can find anything useful. It would also help if I had access to a PC with visual basic on... the only ones we can use at college (for our group) are in the resourse room where every man and his dog is using them. Why couldn't it be done on a mac!

Thanks again for helping - I certainly need it! :yes:

Jo
 
I used to do lots of VB programming its not that hard ... but I tought my self, when I took it in high school I found that the course was stupid and didn't teach anyone much except how to follow step by step instructions.

The first thing to do is the interface:
I'd keep it quite simple
you neet a textbox to get the users input
and another one for the output (you can set it so that its not editable using its properties)

then i'd add buttons for each conversion.


Next you need the code:

double click on a button this will open the code window for that buttons click event (the code that goes in here will be run when the user clicks this button)

it should start with something like this

Code:
Private Sub Command1_Click()

after this you need to add the conversion code

which would look something like this

Code:
If Not IsNumeric(Text1.Text) 'this tests too see if the input is a number
	MsgBox("Error Input is not a number") 'this will show an error message if it is not a number
Else 'otherwise do the conversion
	Text2.Text = F2C(Text1.Text) 'this will convert Fahrenheit to Celsius using the function F2C
End If

just do that for each button changing the function and include the functions you friend gave you

I hope thats clear ... i havent done VB in a long time
 
I feel like my brain is going to explode after reading all that, lol

:no:
 
Back
Top Bottom