473,385 Members | 1,838 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,385 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 1701
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...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.