473,756 Members | 6,970 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_Cli ck(ByVal sender As System.Object, -
ByVal e As System.EventArg s) -

Handles btnBCISLogo.Cli ck
Application.Exi t()
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 1730
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_Cli ck(ByVal sender As System.Object, -
ByVal e As System.EventArg s)
-
Handles btnBCISLogo.Cli ck
Application.Exi t()
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.Exi t() 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_Cli ck(ByVal sender As System.Object, -
ByVal e As System.EventArg s)
-
Handles btnBCISLogo.Cli ck
Application.Exi t()
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_Cli ck(ByVal sender As System.Object, -
ByVal e As System.EventArg s)
-
Handles btnBCISLogo.Cli ck
Application.E xit()
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
7269
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 school. When I tried to open it in the lab, I got a message saying I couldn't open it because it was created with a newer version. Evidently the lab is using Visual Studio.Net 2002. My professor doesn't just want the executable file, he wants...
18
2399
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 of VBA is a real detriment to me. I saw some posts about VBA classes with a particular vendor and the poster was advised not to take the class because of the likelihood of an unskilled trainer. My question is, would taking a Visual Basic...
28
2462
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 I should perhaps learn a more powerful language to program my own apps. I got a "Beginning C" book, but the C programs won't compile in the free compilers I have downloaded. The syntax is different. I guess I have to buy a programming package,...
0
1196
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 on the hyperlink in a particulur cell, problem is, i only want to click on the cells that are highlighted. So question is, whats the code to make sure the macro only clicks on the cells that are highlighted? Thanks for your help, gwmarin
0
9487
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9297
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9904
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9735
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7285
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6556
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5324
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3828
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2697
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.