Top-Rated Free Essay
Preview

Enlistment System

Best Essays
628 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Enlistment System
Imports System.Data.OleDb
Public Class Login 'this codes are the declarations for sql statement Dim connstring As String = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source = " & Application.StartupPath & "\enlistment.mdb;" Dim con As New OleDbConnection(connstring) Dim com As OleDbCommand Dim ds As New DataSet Dim adapter As New OleDbDataAdapter Dim reader As OleDbDataReader Dim User As String

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load AcceptButton = Me.Button1 'this codes will hide or disable a label, textbox and a button Me.Label4.Hide() Me.Label7.Hide() Me.Label8.Hide() Me.Button3.Hide() Me.TextBox1.Enabled = False Me.TextBox2.Enabled = False Me.Button1.Enabled = False 'this codes will show the current time in the form log in Me.Timer1.Enabled = True Me.Timer1.Interval = 1

End Sub

Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged 'this codes will show or hide a label and button, enable a button and textbox, and will clear a textbox and combobox If ComboBox1.Text = "Student" Then Me.Label4.Show() Me.TextBox1.Enabled = True Me.TextBox2.Enabled = True Me.Button1.Enabled = True Me.Label7.Hide() Me.Label8.Hide() TextBox1.Clear() ComboBox1.Text = "" TextBox2.Clear() Me.Button3.Hide()

ElseIf ComboBox1.Text = "Faculty" Then Me.Label4.Show() Me.TextBox1.Enabled = True Me.TextBox2.Enabled = True Me.Button1.Enabled = True Me.Label7.Hide() Me.Label8.Hide() TextBox1.Clear() ComboBox1.Text = "" TextBox2.Clear() Me.Button3.Hide() Else Me.Label4.Hide() Me.TextBox1.Enabled = False Me.TextBox2.Enabled = False Me.Button1.Enabled = False Me.Label7.Hide() Me.Label8.Hide() Me.Button3.Hide() TextBox1.Clear() ComboBox1.Text = "" TextBox2.Clear()

End If End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click 'this codes are used for the log in process Try If ComboBox1.Text = "Student" Then 'this codes will open the database and will select a value from the table con.Open() com = New OleDbCommand("Select * from [inventory] where [UserName] = '" & TextBox1.Text & "' AND [Password] = '" & TextBox2.Text & "' ", con) reader = com.ExecuteReader

'this code will read the table selected from its fields While reader.Read User = reader(0).ToString() & " " & reader(1).ToString() End While

If reader.HasRows Then Me.Label7.Hide() Me.Label8.Hide() Me.Button3.Hide() Me.TextBox1.Enabled = False Me.TextBox2.Enabled = False Me.Button1.Enabled = False successful.Show() TextBox1.Clear() ComboBox1.Text = "" TextBox2.Clear() Me.Label4.Hide()

Else TextBox2.Clear() Label7.Show()

End If reader.Close() con.Close()

ElseIf ComboBox1.Text = "Faculty" Then

con.Open() com = New OleDbCommand("Select * from [faculty] where [username] = '" & TextBox1.Text & "' AND [password] = '" & TextBox2.Text & "' ", con) reader = com.ExecuteReader

While reader.Read User = reader(0).ToString() & " " & reader(1).ToString() End While

If reader.HasRows Then Me.Label4.Hide() Me.Label7.Hide() Me.Label8.Hide() Me.Button3.Hide() Me.TextBox1.Enabled = False Me.TextBox2.Enabled = False Me.Button1.Enabled = False successful1.show() TextBox1.Clear() ComboBox1.Text = "" TextBox2.Clear()

Else

Label7.Show()

End If reader.Close() con.Close()

Else Label7.Show()

End If reader.Close() con.Close() Catch ex As Exception MsgBox("ERROR: " & ex.Message, MsgBoxStyle.Critical)

End Try End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick 'this line of code is to get the current time of the day Label3.Text = TimeOfDay End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Button2.Hide() Me.Label8.Show() Me.Button3.Show() End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click 'this codes will hide a label and a button Me.Label8.Hide() Me.Button3.Hide() Button2.Show() End Sub

End Class

You May Also Find These Documents Helpful

  • Satisfactory Essays

    During the Civil War, the U.S. Congress passes a conscription act that produces the first wartime draft of U.S. citizens in American history. The act called for registration of all males between the ages of 20 and 45, including aliens with the intention of becoming citizens, by April 1. Exemptions from the draft could be bought for $300 or by finding a substitute draftee. This clause led to bloody draft riots in New York City, where protesters were outraged that exemptions were effectively granted only to the wealthiest U.S.…

    • 90 Words
    • 1 Page
    Satisfactory Essays
  • Good Essays

    Military Draft History

    • 1949 Words
    • 8 Pages

    Our Constitution adopted in 1789 gave Congress the "power to raise and support armies", but did not mention or prohibit conscription. This paper reflects my exploration of the history of the draft, complete with court opinions and personal opinions.…

    • 1949 Words
    • 8 Pages
    Good Essays
  • Good Essays

    Selective Military Draft

    • 483 Words
    • 2 Pages

    Despite the fact that there were previous war military drafts in the United States, the first peace draft was sanctioned by Congress in 1940. Later, the draft was deferred in 1973 when the United States transformed to an all-volunteer military and finally, through a Presidential Proclamation, draft registration requirement was dismissed in 1975 but later renewed in 1980. Currently, the Selective Service System, together with the draft registration and local draft panels, remains as a contingency should a military draft ever be necessary, but the country has no active military draft at this time. The military draft requires that almost all male U.S. citizens and foreign male living in the United States who are between 18 to 25 years register with the Selective Service (Tritten). The senate has the power to redefine the qualified persons as it deems suitable. Presently the excluded group of people are the men who are already serving on active military duty, certain institutionalized people, and other noncitizens. The general rule, according to Tritten, is that any male noncitizen who migrates into the United States before his 26th birthday must register with the Selective Service. The exempted ones are the men who live in the…

    • 483 Words
    • 2 Pages
    Good Essays
  • Good Essays

    Military Draft Essay

    • 1924 Words
    • 8 Pages

    When the Civil War broke out and men were needed to serve in the war, the government used conscription, the mandatory induction of men into the military.1 Though some people use this word just like the word draft, the two concepts are different. Draft is the process to determine who will be chosen to serve; it’s like a lottery. Currently, men ages 18-25 have to register with the Select Service with the possibility of serving in the military,2 but conscription itself was abolished in 1973.3…

    • 1924 Words
    • 8 Pages
    Good Essays
  • Good Essays

    Enlistment In 1914 Essay

    • 915 Words
    • 4 Pages

    In the first few weeks after war was declared in 1914, “daily newspaper editorials, political speeches, and lectures from the [government] implored men that their duty to King and Country meant serving in the military. Early recruitment posters urged enlistment on the basis of patriotism and emotional connections to the war’s major issues.” Thousands of men enlisted in the first few weeks from Britain and Canada and even more volunteered after the retreat from Mons in August of 1914, and after the news of the first fatalities there was a renewed rush of enlistment after the fall of Antwerp in October. By the end of 1914 there were hundreds of thousands enlisted which continued into the next year (1915) including men from all areas and social…

    • 915 Words
    • 4 Pages
    Good Essays
  • Good Essays

    Recruitment is a major problem in our armed forces. Even without this problem, the services are too weak to meet the needs of this century. The only way to solve this problem is too bring back the draft. I believe it is time to reconstruct a conscription system that will ensure our country is prepared and protected.…

    • 442 Words
    • 2 Pages
    Good Essays
  • Good Essays

    Military Draft Essay

    • 489 Words
    • 2 Pages

    The draft would be a good way to divide the burden of war so it doesn’t solely affect the people who really want to aid their country. When people feel like the draft is unconstitutional, the draft doesn’t deprive them rights, rather than giving them the right to “defend their country”.(Say Registration or Draft Not Needed 1979) Many people believe that war is bad, and I can agree, but being drafted doesn’t necessarily mean going immediately to war, you could be drafted in a time of no major conflicts and assist in a safe yet vital role in the military as a doctor, nurse or something as simple as a cook to be able to prepare food for hungry troops. For those that volunteer rather than being drafted, carry all the burden on their shoulders while…

    • 489 Words
    • 2 Pages
    Good Essays
  • Good Essays

    Encouraging men to join the war was an essential part in winning. Without patriotic men who were willing to fight, there would be no enthusiasm or determination to win the war. A way to increase soldier enlistment was by creating persuasive posters, pamphlets or movies called propagandas. This influenced many people to take action in helping end the war with a victory. Many people enlisted, volunteered as nurses, manufactured war products, participated in Liberty Loans, grew food in Victory Gardens or helped out in other ways at home. I picked soldier enlistment because I personally feel that this was a vital part in winning the war.You can’t fight a battle without soldiers or recruits. The American military only had 200,000 soldiers before…

    • 252 Words
    • 2 Pages
    Good Essays
  • Good Essays

    The debate of conscription between those who wanted to adopt it or those who still wanted volunteerism was developing and this caused division in society. In 1915, public opinion was changing to demand for conscription, but many still resisted conscription. Women were the most prominent group expressing their opinions of ‘all eligible man should fight’ in publicly, great supporters of conscription. Especially, those who had husbands, brothers or sons overseas fighting began to feel contempt towards men visible in town and called for ‘White Feathers’ which is symbol of ‘cowardice’ to name and shame them into fighting. ‘Shirkers’, however, wanted to choose whether go the fight or not rather than being forced to fight. The Labour movement were another group which initially opposed to…

    • 362 Words
    • 2 Pages
    Good Essays
  • Powerful Essays

    Army Recruitment

    • 3195 Words
    • 13 Pages

    Recruitment of the United States military is a vital part of maintaining an all volunteer military force. Because of recent world events and the high operations tempo of the military, Army has had some problems with its recruitment. Convincing civilians to sign up to be a solider can be a tough job when it requires being sent 7,000 miles from home to go fight in a war zone. What can recruiters do to keep recruitment levels where they need to be to maintain an all volunteer United States military force and how is technology changing their tactics?…

    • 3195 Words
    • 13 Pages
    Powerful Essays
  • Good Essays

    Part of my current project required me too store and retrieve information from a database. I decided to use C# as my target language since I am currently reading Inside C# Second Edition [^] by Tom Archer [^], which by the way is a must have book. However I could not find any examples that were clear and just generic accesing SQL Server with C#.…

    • 2200 Words
    • 9 Pages
    Good Essays
  • Satisfactory Essays

    Vb.Net Study Notes

    • 11890 Words
    • 48 Pages

    |Control.MouseDown Event - Occurs when the mouse pointer is over the control and a mouse button is pressed. |…

    • 11890 Words
    • 48 Pages
    Satisfactory Essays
  • Satisfactory Essays

    str = "insert into Staff values(" & Text1.Text & ",'" & Text2.Text & "', " & Text3.Text & "," & Text4.Text & ",'" & Text5.Text & "')"…

    • 270 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Sexy Time

    • 676 Words
    • 3 Pages

    using System; using System. Collections. Generic; using System. ComponentModel; using System. Data; using System.…

    • 676 Words
    • 3 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Hello, I have a combo box to select the ID, then it will display the particular record from from the database into the text boxes. And now I'm trying to make a update command button. Then I can just change the record which displaying in the text box. And click update, then the record will be updated in the database. But my cmdUpdate_Click() statement seems doesn't work. Anyone can help please? Cheers…

    • 383 Words
    • 2 Pages
    Satisfactory Essays

Related Topics