Visual Basic help please

Soldato
Joined
12 Dec 2006
Posts
3,421
Location
Worthing, West Sussex
Right now, yes I suppose I am your programming tutor :p

Look at these lines:

Dim Total As Integer <-- that is how you define the variable "Total" to hold an integer (round) number
Dim Avg As Integer <-- that is how you define the variable "Avg" to hold an integer (round) number

Now define the variable x to hold an integer (round) number!

The only reason I bold'd and underlined was to try and emphasise important bits to help you along. I wasn't getting arsey ;)
 
Associate
OP
Joined
11 Nov 2006
Posts
549
Location
Devon
i wasn't being arsey with you about you being my programming tutor mate i was saying it because she uses the same method as you. Just little hints to try and get you there but without giving you the whole answer.

Am i right in thinking

Dim x As Integer
 
Last edited:
Permabanned
Joined
18 Oct 2002
Posts
2,275
Shadow you should be thankful for furnace. He has a lot more patience than me. He's pretty much writing your assignment.
 
Associate
Joined
9 Oct 2006
Posts
1,945
Location
Location Location!
shadow4509 said:
i was being arsey with you about you being my programming tutor mate i was saying it because she uses the same method as you. Just little hints to try and get you there but without giving you the whole answer.

Thats because if you give the whole answer then people just copy and paste it. I've taught many people programming and thats ALWAYS the case. It shows that furnace knows exactly what he is doing. I would be greatful that hes not giving you the whole answer.

From your atitude it seems like you don't care about the concept of the programming and just want it to work. I would suggest you think about what atitude you are going to take to the project before getting him to write anymore if it.

Sorry for the lecture but your sarcastic comment hit a nerve.
 
Associate
OP
Joined
11 Nov 2006
Posts
549
Location
Devon
it wasn't meant sarcasticaly at all. Just having a joke, and i do care about learning it. But i'm trying things i havent done before and that i havent been taught so it's new to me. I'm not asking anyone to do it for me and i've asked for help on something im stuck on not the whole assignment.
 
Associate
Joined
9 Oct 2006
Posts
1,945
Location
Location Location!
shadow4509 said:
it wasn't meant sarcasticaly at all. Just having a joke, and i do care about learning it. But i'm trying things i havent done before and that i havent been taught so it's new to me. I'm not asking anyone to do it for me and i've asked for help on something im stuck on not the whole assignment.

Apologies for the overreaction then. Its just in my past I've repeatidly have people ask me to do favours for them ( programming wise ) as a friend and I do them, I try to teach them what im doing as I create it and it never goes in as they get spoonfed then whine until I fix it.

More a vent of frustration at an atitude than you in person :)
 
Associate
OP
Joined
11 Nov 2006
Posts
549
Location
Devon
its fine i understand where your coming from its just irritating me that i cant get it to work. I seem to find and fix one error and then another one appears, but i guess thats what programming is all about. But some of this is very new to me so im trying to learn it and understand but at the same time not get to ahead of myself or whats being taught in class.

I seem to have fixed the variable not defined error and my new error is :

Argument not optional

and it highlights txt_total = total

I think it would be handy for tutors to teach you error messages aswell and explain them.
 
Associate
OP
Joined
11 Nov 2006
Posts
549
Location
Devon
yeah i have done that but im still getting the error message Argument not optional and its highlighting the txt_total = Total part at the top of the code?
 
Last edited:
Associate
OP
Joined
11 Nov 2006
Posts
549
Location
Devon
Yeah darrens on my course too, and his statement about our tutor is not an understatement. I have called her over today (im sitting in lesson now) and asked to run through my code with me, her reply was:

Look at the handouts i gave you!!

My tutor teaches by printing something out and giving it to us. She is not even supposed to be a programming tutor as her specialist area is Databases as she was a systems analyst. Now i have no problems with databases, computer systems etc etc but i do have a problem with my programming, as you guys can clearly see.
 
Soldato
Joined
12 Dec 2006
Posts
3,421
Location
Worthing, West Sussex
shadow4509 said:
txt_total = Total

"Argument Not Optional"
An argument is part of something. If an argument is 'optional', then you dont need to use it. If an argument is NOT optional, then you DO need to use it. That error basically means "something's missing here".

Total is a variable, which is like a bin containing something - in this case, the "bin" called 'total' has a number in it. So I'm going to call variables "bins" from hereon - as it's a good metaphor.

However, txt_total is your textbox. A textbox isn't a variable - it's not a "bin". It's an object, with lots of stuff on it. Some of this stuff on it might be a bin, which you CAN put things in. Some of this stuff might be the colour it is, or the height it is. An object like a textbox appears on the form as - you guessed it - a textbox.

txt_total = Total

That line of code is saying "open the bin 'txt_total' and put the contents of the bin 'Total' in it". But you can't open txt_total because it isn't a bin. It's an object with stuff attached to it.

Now, some of these things attached to the textbox it ARE a bin. And this thing I'm about to talk about is its height property - it tells the program how tall the textbox is. I could put something into this bin by doing this;

txt_total.height = 1040

And then your textbox called txt_total will be 1040 high. You could do the same for its width property, which tells you how wide it is;

txt_total.width = 4000

As you know, txt_total is a textbox. And you can put text in it. When you put text in it, it goes into one of these 'bins' called 'text'. So when you change whats in the textbox, the contents of the 'bin' is changed to whats in the textbox. Likewise, when you change what's in this 'bin', the contents of the bin gets displayed into the textbox. So it works both ways.

I've shown you how to put some into the property 'width', and how to put something into the propert 'height'. You need to put something into the property 'text'.

You programming tutor is only doing things the correct way ;) I hope you realise that doing this is much harder for me than giving you the answer. But you will, in the long run, learn so much more by actually understanding the answer.

If I just told you the answer, you would paste it in and it would be done, but because I haven't done that you've learnt or at least reinforced your knowledge on:
- what OPTION EXPLICIT does
- what a property is
- what it means to declare a variable
- how to find the source of errors

But if someone just gave you answers, you would learn nout
 
Permabanned
Joined
18 Oct 2002
Posts
2,275
furnace said:
Explanation......

clapping.gif


Shadez said:
:eek: I think we should start teaching this course, by the sounds of things we would do a much better job. :cool:

hehe. :)
 
Soldato
Joined
23 Dec 2002
Posts
2,806
Location
Bristol
furnace said:
You programming tutor is only doing things the correct way ;) I hope you realise that doing this is much harder for me than giving you the answer. But you will, in the long run, learn so much more by actually understanding the answer.

The thing is you are doing what his tutor should be, just handing out a piece of paper isnt enough to enable some people to understand how something works.

We all require nudges in the right direction now and again, for me just describing the problem to someone is enough for me to see where im going wrong. If the tutor wont sit down and listen to the problems of her students then she isnt doing here job. :(
 
Associate
OP
Joined
11 Nov 2006
Posts
549
Location
Devon
Just want to say thanks for all the help, input and constructive criticsm from all of you. I do finally have the program calculating and working correctly!!

Furnace that explanation was very good and just what i needed.

Shadez, yes my tutor should sit down with us and explain, i think the fact that more than 3 people have posted on here, from my class, asking for help just shows how well our tutor is doing her job. I wasn't asking her for the code today or to do the assignment for me but to simply have a look and explain where im going wrong and what i need to do to correct it. Anyone can work from a sheet that gives you step by step instructions to make somehting happen.

i do have 1 final question about something ( i have checked all my handouts and its not on there :D ) . I have now added another command button to my application. The command button is to enter a new students details, so basically all i want it to do is clear any information entered so that the form can be reused for a new student .

Again, thanks for all your help!! Its appreciated!
 
Soldato
Joined
12 Dec 2006
Posts
3,421
Location
Worthing, West Sussex
To clear all the textboxes, all you want to do is make all of the textboxes blank.

strString = ""

That puts a blank bit of text into strString. You wanna do something like that, but for every textbox you want to clear :)
 
Back
Top Bottom