OK, one last thing, and then you get to play on your own with your Classes. This time, we are going to use a control created by a class to make an object out of another class, and put that object on our form. In other words, we can create objects whenever we want!
Here is how you do it:
A) Make a new Class called "BlueTextBox". Please name it correctly!!!
B) add the proper "inherits" statement for a TextBox -- see if you can figure out to do this by looking at inherit statements you've done before
C) Using the same proces I JUST SHOWEED YOU, set up a "Layout" SUB for this new Class. Here is what I want you to put inside that:
Text = "This is my new TextBox"
BackColor = Color.Blue
ForeColor = Color.Yellow
D) In the "PopItUp" SUB that you created earlier, you will add some code to make an object from this new Class, and then place that object on your Form
Dim myTextBox As New BlueTextBox( )
myTextBox.Location = New Point(200, 100)
myTextBox.Size = New Size(400, 55)
Form1.Controls.Add(myTextBox)
E) Run your program, and see if you can get that new custom built TextBox to appear when you click on your Label!
Once you have all of that going, do some exploration of your own, and see what else you can find out. MAKE SURE YOU POST A DISCUSSION ON WHAT YOU FIND!
Also, make sure to upload this new version of our project
Cheers,
Mr. L
Wednesday, December 17, 2008
Subscribe to:
Post Comments (Atom)

No comments:
Post a Comment