Man Visual Basic is so confusing

Pierce

Senior member
Sep 21, 2002
226
0
76
I'm taking this programming class and all we're doing is working with Visual Basic. I have a book and all and it is still confusing. All the text and how to create events and what not have got me confused.

Any easier way to know this all? Like a SparkNotes? :(
 

Aikouka

Lifer
Nov 27, 2001
30,383
912
126
Try some tutorials online. I don't have any off-hand and you didn't say which VB version you were using, so I can't really provide any. But when I learned VB way back when, I did so using online tutorials.
 

brandonb

Diamond Member
Oct 17, 2006
3,731
2
0
Its actually alot easier than you think it is. I think you have yourself needlessly confused. :)

Visual Basic is basically object oriented programming.

Think of programming Windows. Your main interface is the window.

It's an object in Visual Basic. It has properties, events, and methods.

What are those?

-Properties. Things like the Caption of the Window is a property. Also things like its position on the screen.

-Events. When the Window has to tell you something, it signals an event. If you move your mouse over the window. It will fire off the "MouseMove" event over and over until the mouse moves off the window.

-Methods. Functions you tell the Window to do. If you want it to Redraw itself, you can tell it to do so.

----

You didn't really say too many specifics. Creating Events. Ok whats confusing about it?

If I'm thinking of the same thing. The CreateEvent method allows you to define your own events. The Window itself has a few build in ones, like MouseMove, etc. Let's say you want to create your own event. One that gets fired when you move the window off the screen, as there isn't a build in event for that. The createEvent lets you name the event, and the parameters it uses. The event doesn't do anything by itself. It's made as a signal of when something happens.

Inside the window code (Resize event), you can have code in there to detect when the window moves off the screen and have it Fire the event that you created.

----

Think of it this way:


(Info coming out of the object is called Events)
^
|
|
(Object - The current state of Object is called Properties)
^
|
|
(Info going into the object is called Methods)

-----

To add onto it, with every object, you have a parent/child relationship.

Window can have controls... (both are objects)

If you lay down a button on the window, the Window is the parent, the button is the child. THe window receives the Events of the Button.

If the button is clicked, the button fires the event for "ButtonClicked", but the Window is what has the handle the buttonClick event and do something if it gets clicked.

----

I hope this helped some. Its hard to know exactly what you need help with.
 

Pierce

Senior member
Sep 21, 2002
226
0
76
Oh my bad I;m using Visual basic 2005

Only thing I'm confused is the things I have to type. I've gone around reading some online tutorials but none of them have helped.

I;m talking about events such getting buttons to work and getting text displayed. All these properties you have to learn and remember and now I'm lost. I just want everything broken down :(