473,382 Members | 1,557 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Visual Basic beginner question

I've been all over the net with this question, I hope I've finally
found a group where I can ask about Visual Basic 2005.

I'm at uni and we're working with Visual Basic 2005. I have some books,

- Programming Visual Basic by Balena (MS Press) and
- Visual Basic 2005 by Willis (WROX),
but they don't go into the forms design aspects and describing the
various controls at all. What bookscan I get that will cover that?

Also, I'm trying out visual inheritance and I'm running into a weird
problem.

I create a form in my class library and put a button on the form. I
then try to assign the click event to that button as follows:
Public Class frmBaseFormT
Private Sub btnBCISLogo_Click(ByVal sender As System.Object, -
ByVal e As System.EventArgs) -

Handles btnBCISLogo.Click
Application.Exit()
End Sub
End Class
When I try to build the class, I get the error

name 'Application' is not defined.

If I do exactly the same in a regular library (not a class library), I
get no error.

Any pointers on what I'm doing wrong?

Thanks

Sep 7 '06 #1
4 1700
Hello mikeb,

The best way to learn about the various controls is to pop them onto a form
and play with them. That's part of the fun.

As for your lil problem.. You should NEVER, EVER try to shut down an application
from within a class library. That class lib could be used anywhere.. and
attempting to shut down the app can cause all kinds of bad stuff to happen.
Applications are inherently unhappy entities.. prone to suicide.. So we,
as programmers, need not encourage them. The application should be the only
entity capable of purposefully terminating the application.

So your form, at most, should consider cleaning itsself up.. Me.Dispose.
By the way.. what's wrong with the close button on the titlebar?

-Boo
I've been all over the net with this question, I hope I've finally
found a group where I can ask about Visual Basic 2005.

I'm at uni and we're working with Visual Basic 2005. I have some
books,

- Programming Visual Basic by Balena (MS Press) and
- Visual Basic 2005 by Willis (WROX),
but they don't go into the forms design aspects and describing the
various controls at all. What bookscan I get that will cover that?

Also, I'm trying out visual inheritance and I'm running into a weird
problem.

I create a form in my class library and put a button on the form. I
then try to assign the click event to that button as follows:

Public Class frmBaseFormT

Private Sub btnBCISLogo_Click(ByVal sender As System.Object, -
ByVal e As System.EventArgs)
-
Handles btnBCISLogo.Click
Application.Exit()
End Sub
End Class
When I try to build the class, I get the error

name 'Application' is not defined.

If I do exactly the same in a regular library (not a class library), I
get no error.

Any pointers on what I'm doing wrong?

Thanks

Sep 7 '06 #2
GhostInAK wrote:
Hello mikeb,

The best way to learn about the various controls is to pop them onto a form
and play with them. That's part of the fun.

As for your lil problem.. You should NEVER, EVER try to shut down an application
from within a class library. That class lib could be used anywhere.. and
attempting to shut down the app can cause all kinds of bad stuff to happen.
Applications are inherently unhappy entities.. prone to suicide.. So we,
as programmers, need not encourage them. The application should be the only
entity capable of purposefully terminating the application.

So your form, at most, should consider cleaning itsself up.. Me.Dispose.
By the way.. what's wrong with the close button on the titlebar?

-Boo
To add to what Ghost wrote (which you should heed by the way), the
reason that you can't call Application.Exit() is becuase the
Application class is defined in the System.Windows.Forms namespace.
You must have a reference to it in your class libarary and possibly add
Imports System.Windows.Forms to the top of your code.

But as Ghost said, don't exit your app from a class library.

Sep 8 '06 #3

GhostInAK wrote:
Hello mikeb,

The best way to learn about the various controls is to pop them onto a form
and play with them. That's part of the fun.
I was looking for a control that would allow me to create hotspots in a
map. Putting every type of control on a form seem like a terribly slow
process to finding out how to do things.
>
As for your lil problem.. You should NEVER, EVER try to shut down an application
from within a class library. That class lib could be used anywhere.. and
attempting to shut down the app can cause all kinds of bad stuff to happen.
Applications are inherently unhappy entities.. prone to suicide.. So we,
as programmers, need not encourage them. The application should be the only
entity capable of purposefully terminating the application.

So your form, at most, should consider cleaning itsself up.. Me.Dispose.
By the way.. what's wrong with the close button on the titlebar?
So our project for the semester is to write a kiosk application with
information and reservation options for a cruise. It should have no
title bar so it cannot be closed down by rascals. Instead it has to
have a "secret" clickable logo on all pages, that when clicked will
close down the application. Also, after testing it must be possible to
easily remove this control.

Since this code is exactly the same in the entire application, I didn't
see the harm in putting that clickable control on the master form. If I
had to hand-code the control on each and every form it is a lot of
redundancy and I'm sure I'll get marked down.
>
-Boo
I've been all over the net with this question, I hope I've finally
found a group where I can ask about Visual Basic 2005.

I'm at uni and we're working with Visual Basic 2005. I have some
books,

- Programming Visual Basic by Balena (MS Press) and
- Visual Basic 2005 by Willis (WROX),
but they don't go into the forms design aspects and describing the
various controls at all. What bookscan I get that will cover that?

Also, I'm trying out visual inheritance and I'm running into a weird
problem.

I create a form in my class library and put a button on the form. I
then try to assign the click event to that button as follows:

Public Class frmBaseFormT

Private Sub btnBCISLogo_Click(ByVal sender As System.Object, -
ByVal e As System.EventArgs)
-
Handles btnBCISLogo.Click
Application.Exit()
End Sub
End Class
When I try to build the class, I get the error

name 'Application' is not defined.

If I do exactly the same in a regular library (not a class library), I
get no error.

Any pointers on what I'm doing wrong?

Thanks
Sep 11 '06 #4
Hello mikeb,

The solution is simple then, and doesn't break guidelines for class libraries.

Have the application enable the titlebar on each form for testing.. then
in production mode (in response to something in the config file perhaps)
have the app disable all titlebars.

-Boo

GhostInAK wrote:
>Hello mikeb,

The best way to learn about the various controls is to pop them onto
a form and play with them. That's part of the fun.
I was looking for a control that would allow me to create hotspots in
a map. Putting every type of control on a form seem like a terribly
slow process to finding out how to do things.
>As for your lil problem.. You should NEVER, EVER try to shut down an
application
from within a class library. That class lib could be used anywhere..
and
attempting to shut down the app can cause all kinds of bad stuff to
happen.
Applications are inherently unhappy entities.. prone to suicide.. So
we,
as programmers, need not encourage them. The application should be
the only
entity capable of purposefully terminating the application.
So your form, at most, should consider cleaning itsself up..
Me.Dispose. By the way.. what's wrong with the close button on the
titlebar?
So our project for the semester is to write a kiosk application with
information and reservation options for a cruise. It should have no
title bar so it cannot be closed down by rascals. Instead it has to
have a "secret" clickable logo on all pages, that when clicked will
close down the application. Also, after testing it must be possible to
easily remove this control.

Since this code is exactly the same in the entire application, I
didn't see the harm in putting that clickable control on the master
form. If I had to hand-code the control on each and every form it is a
lot of redundancy and I'm sure I'll get marked down.
>-Boo
>>I've been all over the net with this question, I hope I've finally
found a group where I can ask about Visual Basic 2005.

I'm at uni and we're working with Visual Basic 2005. I have some
books,

- Programming Visual Basic by Balena (MS Press) and
- Visual Basic 2005 by Willis (WROX),
but they don't go into the forms design aspects and describing the
various controls at all. What bookscan I get that will cover that?
Also, I'm trying out visual inheritance and I'm running into a weird
problem.

I create a form in my class library and put a button on the form. I
then try to assign the click event to that button as follows:

Public Class frmBaseFormT

Private Sub btnBCISLogo_Click(ByVal sender As System.Object, -
ByVal e As System.EventArgs)
-
Handles btnBCISLogo.Click
Application.Exit()
End Sub
End Class
When I try to build the class, I get the error
name 'Application' is not defined.

If I do exactly the same in a regular library (not a class library),
I get no error.

Any pointers on what I'm doing wrong?

Thanks

Sep 12 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: angelag | last post by:
I am currently taking a college course in Visual Basic.Net and I am a beginner. I bought Visual Studio.Net 2003 to do my homework at home. I built my first project and e-mailed it to myself at...
18
by: Ann Scharpf via AccessMonster.com | last post by:
I am not sure which would be the best place to post this question, so I'm posing it here with Access general questions. I have reached the point many times in Word and in Access where my ignorance...
28
by: grappletech | last post by:
I took Pascal and BASIC in a couple of beginner programming courses about a decade ago and did well with them. I am good with pseudocode, algorithms, and the mathematics of programming. I decided...
0
by: gwmarin | last post by:
Hello, i am a complete beginner with visual basic so lets see if i can explain my problem. I've got microsoft excel 2003 which has got Visual Basic 6.5 and i need to create a macro which will click...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.