Monday, February 16, 2009

India kicks off South Asia`s biggest air show

Bangalore (ANTARA News) - South Asia's biggest airshow opened here Wednesday with firms from 25 countries showcasing their latest hardware in a chase for multi-billion dollar contracts with the Indian military.


Despite the global economic downturn, nearly 600 armament and aerospace companies -- half of them from overseas -- are taking part in this year's Aero India event in Bangalore.

Regional rival Pakistan has not been invited to the five-day event but China is participating for the first time.

"We don't invite Pakistan to our air shows," India's Defence Production Secretary Pradeep Kumar was quoted by AFP as saying. Tensions between the nuclear-armed neighbours have soared in the wake of last November's attacks in Mumbai which India blames on a Pakistan-based Islamist group.

Even with India's economy showing signs of a deepening slowdown, its million-plus military says it cannot cut defence spending and plans to hand out contracts worth 30 billion dollars in the next three to four years.

India has already imported military hardware worth 28 billion dollars since 2000.

Among the prime pickings is a 12-billion dollar deal for 126 fighter jets. Six major aeronautical firms competing for the contract are participating in the air show.

Leading the pack of 303 international companies at the event are Germany and France with 31 firms each. Twenty-six British, 24 Russian and 22 US firms are also present, along with 289 Indian defence companies.

Britain's ambassador to New Delhi, Richard Stagg, said India needed modern weaponry.

"Against the backdrop of a very turbulent neighbourhood and very difficult domestic security issues, India is keen to ensure that its armed forces are promptly equipped with the best equipment," he said in Bangalore.

India says it is "fast-tracking" all arm procurement negotiations amid the heightened tensions with Pakistan.

"For the first time, there will be business-to-business meetings on a large scale," secretary Kumar said, adding that 500 such discussions had already been scheduled.

Besides the 126 fighter jets, transport aircraft and airborne early warning systems, the Indian military also plans to buy 700 helicopters worth 3.5 billion dollars and an array of air defence systems.

Israel, which replaced France in 2007 as India's second-largest arms supplier after Russia, has sent its top 10 defence firms, including Rafael, which last September grabbed a 260-million-dollar missile contract.

India also hopes to find buyers for a supersonic cruise missile it has jointly built with Russia.

Security has been especially tight this year around the Yelahanka Air Force Station venue.

"The effort is to have a fool-proof system," Kumar said.

Sunday, February 15, 2009

Health Precautions

General Cautions
Recent medical and dental exams should ensure that the traveler is in good health. Carry appropriate health and accident insurance documents and copies of any important medical records. Bring an adequate supply of all prescription and other medications as well as any necessary personal hygiene items, including a spare pair of eyeglasses or contact lenses if necessary.
Drink only bottled beverages (including water) or beverages made with boiled water. Do not use ice cubes or eat raw seafood, rare meat or dairy products. Eat well-cooked foods while they are still hot and fruits that can be peeled without contamination. Avoid roadside stands and street vendors.
Swim only in well-maintained, chlorinated pools or ocean water known to be free from pollution; avoid freshwater lakes, streams and rivers. Wear clothing which reduces exposed skin and apply repellents containing DEET to remaining areas.
Sleep in well-screened accommodations. Carry anti-diarrhea medication. Reduce problems related to sun exposure by using sunglasses, wide-brimmed hats, sunscreen lotions and lip protection.

Specific Concerns


AIDS occurs. Blood supply may not be adequately screened and/or single-use, disposable needles and syringes may be unavailable. When possible, travelers should defer medical treatment until reaching a facility where safety can be assured.


The large number of tropical plants and pollution levels inurban areas may cause children and adults with asthma problems severe discomfort.

Immunizations
These recommendations are not absolute and should not be construed to apply to all travelers. A final decision regarding immunizations will be based on the traveler's medical history, proposed itinerary, duration of stay and purpose for traveling.

Hepatitis A
Consider active immunization with hepatitis A vaccine or passive immunization with immune globulin (IG) for all susceptible travelers. Especially consider choosing active immunization for persons planning to reside for a long period or for persons who take frequent short-term trips to risk areas. The importance of protection against hepatitis A increases as length of stay increases. It is particularly important for persons who will be living in or visiting rural areas, eating or drinking in settings of poor or uncertain sanitation, or who will have close contact with local persons (especially young children) in settings with poor sanitary conditions.

Hepatitis B
Vaccination is advised for health care workers, persons anticipating direct contact with blood from or sexual contact with inhabitants, and persons planning extended stays of 6 months or greater (especially those who anticipate using local health care facilities, staying in rural areas, or having intimate contact with the local population).

Japanese encephalitis
Consider vaccination if staying a month or more on Bali, Irian Jaya, Java, Kalimantan, Lombok, Mollucas, Nusa Tenggara or Sulawesi, especially if travel includes rural areas. Also consider if staying less than 30 days and at high risk (in case of epidemic outbreak or extensive outdoor
exposure in rural areas). While transmission likely occurs all year and varies by island, peak risk is generally from November to March, although it is June to July in some years. Human cases have historically been reported only on Bali and Java.
one-time booster dose is recommended for travelers who have previously completed a standard course of polio immunization. Refer to CDC guidelines for vaccinating unimmunized or incompletely immunized persons. Pregnancy is a relative contraindication to vaccination; however, if protection is needed, either IPV or OPV may be used, depending on preference and time available.

Rabies
Preexposure vaccination should be considered for travel to Java, Kalimantan, Sumatra or Sulawesi for persons staying longer than 30 days who are expected to be at risk to bites from domestic and/or wild animals (particularly dogs), or for persons engaged in high risk activities such as spelunking or animal handling. Need for vaccination is more important if potential exposure is in rural areas and if adequate postexposure care is not readily available.

Typhoid
Vaccination should be considered for persons staying longer than 3 weeks, adventurous eaters, and those who will venture off the usual tourist routes into small cities, villages and rural areas. Importance of vaccination increases as access to reasonable medical care becomes limited.
Contraindications depend on vaccine type.
All routine vaccines (such as DTP or Td, Hib, MMR, polio, varicella, influenza and pneumococcal) should be kept up-to-date as a matter of good health practice unrelated to travel.

Disease Risk Summary
The general level of community sanitation and public health awareness is low throughout Indonesia.
Insect-borne illness: considered an important cause of disease in this area.
Encephalitis (Japanese type) - occurs (risk may extend to resort areas, including those on Bali)
Filariasis - prevalent in rural areas
Malaria - common
Typhus (mite-borne) - occurs in deforested areas
Food-borne and water-borne illness: these diseases are common.
Cholera - occurs
Dysentery (amoebic and bacillary) - occurs
Fasciolopsiasis (giant intestinal fluke) - occurs
Hepatitis - occurs
Melioidosis - occurs
Schistosomiasis - occurs on the island of Sulawesi

Other hazards:
Diseases such as measles and diphtheria are commonly reported, and cases of polio still occur regularly.
Influenza risk extends throughout the year.
Rabies - occurs on Java, Kalimantan, Sumatra and Sulawesi
Trachoma - occurs

Yellow fever
A yellow fever vaccination certificate is required from
travelers coming from infected areas. A certificate is also required from
travelers arriving from countries in the endemic zones.

Malaria Information

Risk areas
Risk exists throughout the year in all areas of Irian Jaya and in rural areas of other islands (exceptions are metropolitan areas of Jakarta, Jogakarta, Surabaya, Medan, and Denpasar plus contiguous tourist beach areas of Bali). Chloroquine-resistant falciparum is confirmed, and chloroquine-resistant .. vivax is reported. Fansidar resistance is reported in several areas and resistance to mefloquine may occur. WHO reports that P. falciparum is responsible for 49% of cases. Java and Bali report a total of 16,000 cases annually, with an added 59,000 reported from the Outer Islands.

Protective measures
advises that risk is limited to areas not usually visited by travelers and recommends that only travelers likely to have evening or nighttime exposure in risk areas undertake chemoprophylaxis with mefloquine in addition to personal protective measures. Persons with epilepsy, psychiatric disorders or known hypersensitivity to mefloquine should not use this drug and should consider alternate means of protection. Consult your physician regarding additional precautions and potential side effects.

Current Health Concerns
According to postings on ProMED, 8 people are dead and 46 others have been hospitalized in the eastern province of Nusa Tangara due to rabies. Initial investigation by health officials seemed to indicate that the disease was not rabies, but further tests proved that dogs carrying rabies were responsible for the deaths. An order has been issued to capture and destroy approximately 170,000 stray dogs in Nusa Tangara.

Posted 15 May 1998.
According to press reports, dengue hemorrhagic fever has claimed the lives of approximately 800 people in Indonesia since the beginning of the year.
Dengue fever is common during the monsoon season, which generally lasts from October to April, but government officials have stated that this year's outbreak is extraordinary. At least 32,000 people have been infected since January 1998.
Localized outbreaks have been recorded in several locations, notably the
district of Palembang in South Sumatra Province, the cities of Bandung and Jakarta in West Java Province, the town of Dili in East Timor Province and the town of Palu in Central Sulawesi Province. Jakarta alone has seen nearly 80 deaths among 10,000 cases. At least 12 of Indonesia's 27 provinces have recorded fatalities, and the number of deaths reported is believed to be a fraction of the actual totals.

Posted 15 May 1998.
According to press reports, an outbreak of hepatitis A has affected more than 600 people in the regency of Bondowoso in Eastern Java. Eight villages in the districts of Tapan, Wonsari and Sukosari have been affected, the largest in the region's history. Poor hygiene and contaminated river water have been cited as causes of the outbreak.

Posted 24 April 1998.
According to press reports, a choking smog from forest fires burning out of control in the province of East Kalimantan on the island of Borneo has compromised the health of thousands of people in the cities of Samarinda and Balikpapan, as well as in surrounding areas. At least 300 cases of pneumonia have been reported, and ailments such as eye infections, respiratory infectionsand asthma are on the rise. One newspaper has reported that at least 2 people have died due to the haze. After dissipating for a few months, the haze has returned to Southeast Asia as land has been deliberately burned and seasonal monsoon rains have been held off by the El Nino weather phenomenon.

Posted 24 March 1998.
USDOS Advisory
The material below is reprinted verbatim from the U.S. Department of State (USDOS). Recommendations regarding preventive health measures (including immunizations), if given here, may differ from those of the CDC/ACIP presented elsewhere in this report. Health-related entry requirements, if included here, may not agree with the official version of requirements reported by WHO and presented in the Official Health Data section of this report.

Consular Information Sheet - April 24, 1998
Country Description
Indonesia is an independent republic consisting of more than 13,500 islands spread over 3,000 miles. Its economy is developing, and tourist services are plentiful in the major tourist sites.
Entry Requirements: A passport valid for six months beyond the
intended date of departure is required. A visa is not required for tourist
stays up to two months. For additional information about entry requirements, travelers may contact the Embassy of the Republic of Indonesia, 2020 Massachusetts Avenue NW, Washington, DC 20036, telephone (202) 775-5200,
http://www.kbri.org/

Information on Crime
The crime rate in Jakarta is moderate but rising. Minor crimes, such as pickpocketing and thefts, occur in popular tourist sites throughout the country. Incidents of carjackings and robbery have been reported. Lost or stolen passports should be reported to the local police and the citizins. Embassy or nearest consulate.

Criminal Penalties: While in a foreign country, a citizen is subject to that country's laws and regulations, which sometimes differ significantly from those in their countries and do not afford the same protections available to the individual under their. law. Penalties for breaking the law can be more severe than in your countrie for similar offenses.
Persons violating the law, even unknowingly, may be expelled, arrested or imprisoned. Criminal penalties for possession, use or trafficking of illegal drugs are strict, and convicted offenders can expect severe jail sentences and fines.

Road Safety: All traffic operates on the left side of the road, and most vehicles use right-hand drive. Roads in major cities and toll roads are good. Roads are narrower and may be more poorly maintained in rural areas and remote regions. Driving at night outside major cities can be hazardous. Taxis are an affordable means of transportation. The safest option is to call the taxi company directly. Make sure the taxi driver agrees to take you to your destination, never get into a taxi already occupied by another passenger and always insist on using the taxi meter. A list of taxi safety tips, along with a list of more reputable taxi companies, is available from the U.S. Embassy in Jakarta.

Aviation Oversight
The U.S. Federal Aviation Administration (FAA) has assessed the Government of Indonesia civil aviation authority as Category 1 - in compliance with international aviation safety standards for oversight of Indonesia's air carrier operations. For further information, travelers may contact the Department of Transportation within the U.S. at (800) 322-7873 or visit the FAA Internet home page at http://www.faa.gov/AVR/iasa.htm

The U.S. Department of Defense (DOD) separately assesses some foreign air carriers for suitability as official providers of air services. For information regarding the DOD policy on specific carriers, travelers may contact the Pentagon at (703) 697-7288.

Embassy Location and Registration
Americans are encouraged to register at the nearest U.S. embassy or consulate, where they may obtain updated information on travel and security within the country. The embassy is located in Jakarta at Medan Merdeka Selatan 5; telephone (62)(21) 344-2211, fax (62)(21)
386-2259, Internet: http://www.usembassyjakarta.org/

Saturday, February 14, 2009

Operating System Functions

What is an Operating System

The operating system is the core software component of your computer. It performs many functions and is, in very basic terms, an interface between your computer and the outside world. In the section about hardware, a computer is described as consisting of several component parts including your monitor, keyboard, mouse, and other parts. The operating system provides an interface to these parts using what is referred to as "drivers". This is why sometimes when you install a new printer or other piece of hardware, your system will ask you to install more software called a driver.

What does a driver do?

A driver is a specially written program which understands the operation of the device it interfaces to, such as a printer, video card, sound card or CD ROM drive. It translates commands from the operating system or user into commands understood by the the component computer part it interfaces with. It also translates responses from the component computer part back to responses that can be understood by the operating system, application program, or user. The below diagram gives a graphical depiction of the interfaces between the operating system and the computer component

Operating System Functions

What is an Operating System

The operating system is the core software component of your computer. It performs many functions and is, in very basic terms, an interface between your computer and the outside world. In the section about hardware, a computer is described as consisting of several component parts including your monitor, keyboard, mouse, and other parts. The operating system provides an interface to these parts using what is referred to as "drivers". This is why sometimes when you install a new printer or other piece of hardware, your system will ask you to install more software called a driver.

What does a driver do?

A driver is a specially written program which understands the operation of the device it interfaces to, such as a printer, video card, sound card or CD ROM drive. It translates commands from the operating system or user into commands understood by the the component computer part it interfaces with. It also translates responses from the component computer part back to responses that can be understood by the operating system, application program, or user. The below diagram gives a graphical depiction of the interfaces between the operating system and the computer component


Friday, February 13, 2009

Accessing databases using the ADO Data Control

Download and Run Example Program

Okay, this is the promised ADO example program. It's exactly the same as the example I did for the Data Control and the FlexGrid, but with a few added bells and whistles. Also, it works right away with an Access 97 or 2000 database, which makes things much more convenient. Okay, let's get into this thing:

Okay, the steps to follow:

  1. Just save the file to your desktop.
  2. Double click the file to open it with winzip.
  3. Click "Extract" and extract the file to your desktop (note: you need to extract both files).
  4. On your desktop, you should now have a folder called "ADOExample"
  5. Go in there and double-click "Projcet1.vbp" (.vbp stands for "Visual Basic Project")
  6. Now, you should get VB loaded up with that project, no problem!

With that going, you can push the play button (center of the top tool bar) and see what it looks like. There are a couple of things you can do with it:

  • You can add CDs to the Database by entering some info in the textboxes and pushing the "Add This Info" button
    • This has changed: now, the "Add Entry" button will not enable until all three textboxes contain text.
    • The "Track Count" textbox will only accept numeric characters
    • This program does not check for duplicate entries in the database. If you do that, it'll crash. :)
  • You can select a row from the grid and hit the "Remove Selected" button to remove it permanently from the database
  • The form now resizes properly. So, if you resize the form, the grid and frames will resize appropriately (to a certain point)


Build Example Program 6 from Scratch:

Okay, let's get down and dirty. :) This one's quite a bit bigger than the other one (although the bigger is more or less useless stuff that was thrown in for fun, haha!).

The Database Design

  1. Open up MS Access (Start - Programs - Microsoft Access)
  2. Pick "Start a blank database" from the wizard that pops up
  3. Pick a spot to save the mdb file and a name for it (mine was "CDCollectionA.mdb")
  4. You'll get to the following window, where you double click on "Create a table in design view:"


the database design main window

  1. When you double click that "create table in design view" thingie, you get to this window:


The table design view window

  1. You want to follow the following steps to get the table I was working with:
    1. Make a field called ArtistName whose type is Text
    2. Make a field called AlbumTitle whose type is Text
    3. Make a field called Tracks whose type is Number (just a long integer is cool enough)
    4. Select the rows in the design view (as pictured above) that have ArtistName and AlbumTitle
    5. Right-click on that selection, and pick Primary Key from the menu you get. This will make both fields into primary keys. The idea is that they can be primary because you'll never have identical artist names and album titles (otherwise what's the point?!).
  2. Once you've got your table built, just close that window. You'll be automatically prompted to save changes to the table design and to give the table a name. I picked CDs, how original. :)
  3. Once that's all done, you can either add a couple entries to the database by double clicking the CDs table from the database design main window and inputting them manually or just move on to:

Software Design

Okay, as mentioned at the top of this article, we're going to use the ADO (ActiveX Data Objects) data control for getting at data instead of the common data control used in Example 3. I know what you're thinking: who cares. :) In any case, ADO can provide you with a little more customizability and a little bit more speed, but it's also a little more difficult to use. No problem, though, there's a cheap way around everything, so let's dive right in.

  1. First thing first, start up VB with a Standard Exe project.
  2. Go to the Project menu and select Components (near the bottom). You want to add two new controls to your project:
    • the Microsoft ADO Data Control (OLEDB) and
    • the Microsoft Hierarchical FlexGrid Control 6.0 (note this is not the FlexGrid as used in Example 3)


the add components dialog

  1. Okay, now do the following stuff to your main form:
    1. Change the caption of your main form to something hip and jive ...
    2. Add a Heirarchical FlexGrid to your form by picking the tool and drawing it on your main form.
    3. Add an ADO data source control to the form using the tool and drawing on the form. Change its visibility property to False.
    4. Add two frames to the form using the tool and drawing them on the form.
      • Change for one frame:
        • its caption to Add Entry
        • its (name) to fraAddEntry
      • Change for the other (second) frame:
        • its caption to Remove Entry
        • its (name) to fraRemoveEntry
    5. Draw the following controls in the Add Entry frame (yes, actually in the frame):

1. A text box with the (name) txtArtistName

2. A label above that text box with the caption Artist Name

3. A text box with the (name) txtAlbumTitle

4. A label above that text box with the caption Album Title

5. A text box with the (name) txtTrackCount

6. A label above that text box with the caption Number of Tracks

7. A command button with the (name) cmdAddEntry and the caption Add this info

    1. Now, to the Remove Entry frame, add the following controls:

0. A command button with the (name) cmdRemoveEntry and the caption Remove Selected

1. A label with the caption Select the entry you want to remove and click the button:

  1. Now, the most complicated part is formatting the Heirarchical FlexGrid (which is called MSFHlexGrid1) to do what you want. It's fairly customizable, but here's all I did for this example program:
    1. the AllowBigSelection property was set to False
    2. the AllowUserResizing property was set to 0
    3. the FixedCols property was set to 0 while the FixedRows property was set to 1 (this is recommended for pretty displaying of stuff)
    4. the FocusRect property was set to 0
    5. the HighLight property was set to 1
    6. the ScrollBars property was set to 2
    7. the ScrollTrack property was set to True
    8. the SelectionMode property was set to 1 (selection by row only)
  2. In the form design window, double click the form, which should bring up the code window with a blank Form_Load() subroutine.
    • You'll notice this time that we do the data and database hookup in code instead of in the property sheet.
    • For the ConnectionString property of the ADO Data Control, you can build it in the property sheet. There's a wizard in there that will do it from scratch for you, but it's pretty annoying to surf through. That's why I just included this string instead (it was built in the wizard though)
    • You need two global variables, and they appear right above the Form_Load() method.
    • For the FlexGrid DataSource, note that the Set command/directive/whatever is used!! Here's the code:
Option Explicit
 
' couple'o global vars to track the form minimum size
Dim MinHeight As Long
Dim MinWidth As Long
 
Private Sub Form_Load()    
    ' set up the database connectivity for the ADO data control
    With Adodc1
        
        ' the connection string just defines an interface to connect
        ' to the Access database.  We use the MS Jet SQL drivers for
        ' simplicity's sake.  Side-note: you can build your own connection string
        ' from the property sheet for the ado data control, but I would advise
        ' against it, this is easier. :)
        .ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
            App.Path & "\CDCollection.mdb;Persist Security Info=False"
            
        ' the record source just tells the data control what and how
        ' to pull out of the database. Just raw SQL here.
        .RecordSource = "select * from CDs order by ArtistName"
    End With
    
    ' set the Flex Grid data source to be the ADO data control.
    Set MSHFlexGrid1.DataSource = Adodc1
    
    ' set up the format string for the flex grid.
    MSHFlexGrid1.FormatString = "Artist Name | Album Title | Track Count"
    
    ' position all the controls happily and store the form minimum size
    MinHeight = Form1.Height
    MinWidth = Form1.Width
    Call Form_Resize    
End Sub
  1. Okay, that's done. From the event ComboBox at the top of the code window, pick the Resize event. You should then get a shell for the Form_Resize() method. This gets called whenever you resize the form, and we'll just use it to make a resized form look pretty. Here's what to fill in:
Private Sub Form_Resize()    
    ' check to see if the form is getting too small (Note: this is just to avoid
    ' the math necessary to shrink all the textboxes, hahahaha!!)
    If MinHeight > Form1.Height Then
        Form1.Height = MinHeight
        Exit Sub
    ElseIf MinWidth > Form1.Width Then
        Form1.Width = MinWidth
        Exit Sub
    End If
 
    ' resize the flexgrid to fit nicely on the screen
    MSHFlexGrid1.Width = Form1.ScaleWidth
    MSHFlexGrid1.Height = Form1.ScaleHeight / 2
 
    ' resize the happy columns to look pretty (40% for each text column, 20% for Track)
    MSHFlexGrid1.ColWidth(0) = 0.4 * MSHFlexGrid1.Width
    MSHFlexGrid1.ColWidth(1) = MSHFlexGrid1.ColWidth(0)
    MSHFlexGrid1.ColWidth(2) = MSHFlexGrid1.Width - (MSHFlexGrid1.ColWidth(0) * 2) - 60
    
    ' reposition  and resize the frames on the screen to fit nicely (there was no
    ' science here, just did it by trial and error)
    fraAddEntry.Top = (Form1.ScaleHeight / 2) + 100
    fraAddEntry.Height = (Form1.ScaleHeight / 2) - 150
    fraAddEntry.Width = (Form1.ScaleWidth * 0.64)
    fraRemoveEntry.Height = (Form1.ScaleHeight / 2) - 150
    fraRemoveEntry.Top = (Form1.ScaleHeight / 2) + 100
    fraRemoveEntry.Width = (Form1.ScaleWidth * 0.36) - 100
    fraRemoveEntry.Left = fraAddEntry.Width + 100
End Sub
  1. Now, go back to the form design window and double click the Add this info button. You should now have a blank cmdAddEntry_Click() subroutine. The code is pretty much identical to the old database example, but here's what to fill in, anyways:
Private Sub cmdAddEntry_Click()
    ' add a new entry to our table.
    With Adodc1.Recordset
        .AddNew
        !ArtistName = txtArtistName
        !AlbumTitle = txtAlbumTitle
        !Tracks = txtTrackCount
        .Update
        .Requery
    End With
        
    ' refresh the data source and rebind it to the flexgrid (annoying!!)
    Adodc1.Refresh
    Set MSHFlexGrid1.DataSource = Adodc1
    MSHFlexGrid1.FormatString = "Artist Name | Album Title | Track Count"
    Call Form_Resize
 
    ' clear the text fields once the new record is added
    txtArtistName = ""
    txtAlbumTitle = ""
    txtTrackCount = ""
    
    ' set the focus back to the  artist name textbox
    txtArtistName.SetFocus
End Sub
  1. Now you need the remove code. In the form design window, double-click the Remove Selected button. You should get a shell for the cmdRemoveEntry_Click() subroutine. This is the code:
Private Sub cmdRemoveEntry_Click()
    ' delete an entry from the database
    With Adodc1.Recordset
        .Move (MSHFlexGrid1.Row - 1) ' we minus one because row zero is the header row
        .Delete
        .Requery
    End With
    
    ' refresh the data source and rebind it to the flexgrid (annoying!!)
    Adodc1.Refresh
    Set MSHFlexGrid1.DataSource = Adodc1
    MSHFlexGrid1.FormatString = "Artist Name | Album Title | Track Count"
    Call Form_Resize
    
    ' set the focus back to the first add field
    txtArtistName.SetFocus
End Sub
  1. Okay, if you go to the form design window, you have three textboxes: txtArtistName, txtAlbumTitle, and txtTrackCount. Double click on each of them in turn to get their associated Change methods and fill in the following code:
Private Sub txtArtistName_Change()
    ' here, just check to see if each text field has contents.  If they all have
    ' contents (ie, they're not empty) enable the "Add Entry" button.
    If txtArtistName.Text <> "" And txtAlbumTitle.Text <> "" And txtTrackCount.Text <> "" Then
        cmdAddEntry.Enabled = True
    Else
        cmdAddEntry.Enabled = False
    End If
End Sub
 
Private Sub txtAlbumTitle_Change()
    ' just call the artist name change method because the code here would be
    ' exactly the same.
    Call txtArtistName_Change
End Sub
 
Private Sub txtTrackCount_Change()
    ' just call the artist name change method because the code here would be
    ' exactly the same.
    Call txtArtistName_Change
End Sub
  1. While you're still in the txtTrackCount_Change() method, go to the event ComboBox at the top of the code window and select the KeyPress event. You should get a shell for the txtTrackCount_KeyPress(KeyAscii as Integer) method. Here's the rest of the code for that, it just filters out alphabetic and punctuation characters:
Private Sub txtTrackCount_KeyPress(KeyAscii As Integer)
    ' TrackKey will store which key was pressed in an _ascii_ value.
    Dim TrackKey As String
    TrackKey = Chr(KeyAscii)
    
    ' if the key pressed was a)not a number and b) not the backspace key,
    ' just erase the keystroke (it won't get processed or sent)
    If (Not IsNumeric(TrackKey) And Not (KeyAscii = vbKeyBack)) Then
        KeyAscii = 0
    End If
End Sub