Advertisement
Scorpionh

Sem4 TP2

Apr 15th, 2015
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 14.47 KB | None | 0 0
  1. Public Class Form1
  2.  
  3.    
  4.    
  5.  
  6.  
  7.     Private Sub PanelGenre_Paint(sender As System.Object, e As System.Windows.Forms.PaintEventArgs) Handles PanelGenre.Paint
  8.         Dim cmp As Integer = 2
  9.         Dim libelle(2) As String
  10.         libelle(0) = "MR"
  11.         libelle(1) = "MME"
  12.         libelle(2) = "MLLE"
  13.         For Each but As RadioButton In PanelGenre.Controls
  14.             but.Text = libelle(cmp)
  15.             cmp -= 1
  16.         Next
  17.  
  18.  
  19.     End Sub
  20.  
  21.     Private Sub RadioButton4_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles RadioButton4.CheckedChanged
  22.         If RadioButton4.Checked = True Then
  23.             PanelCode.Visible = True
  24.             TextBoxCode.Focus()
  25.         Else
  26.             PanelCode.Visible = False
  27.         End If
  28.  
  29.  
  30.     End Sub
  31.  
  32.     Private Sub RadioButton5_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles RadioButton5.CheckedChanged
  33.         PanelPays.Visible = Not (PanelPays.Visible)
  34.         If PanelPays.Visible = True Then
  35.             TextBoxPays.Focus()
  36.         End If
  37.     End Sub
  38.  
  39.  
  40.    
  41.    
  42.     Private Sub valid_Click(sender As System.Object, e As System.EventArgs) Handles valid.Click
  43.         If TextBoxCode.TextLength <> 5 OrElse (TextBoxCode.Text(0) = "0" And TextBoxCode.Text(1) = "0") Then
  44.             CodePost.BackColor = Color.Red
  45.         Else
  46.             TextBoxCode.BackColor = Color.White
  47.         End If
  48.  
  49.     End Sub
  50.  
  51.     Private Sub TextBoxCode_KeyPress(sender As System.Object, e As System.Windows.Forms.KeyPressEventArgs) Handles TextBoxCode.KeyPress
  52.         If e.KeyChar < "0" Or e.KeyChar > "9" Then
  53.             If e.KeyChar <> ControlChars.Back Then
  54.                 e.Handled = True
  55.  
  56.             End If
  57.  
  58.         End If
  59.     End Sub
  60.  
  61.     Private Sub TextBoxNom_KeyPress(sender As System.Object, e As System.Windows.Forms.KeyPressEventArgs) Handles TextBoxNom.KeyPress
  62.         e.Handled = VerifNotAlpha(e.KeyChar)
  63.  
  64.     End Sub
  65.  
  66.     Private Sub TextBoxPrenom_KeyPress(sender As System.Object, e As System.Windows.Forms.KeyPressEventArgs) Handles TextBoxPrenom.KeyPress
  67.         e.Handled = VerifNotAlpha(e.KeyChar)
  68.     End Sub
  69.  
  70.     Private Sub TextBox_KeyPress(sender As System.Object, e As System.Windows.Forms.KeyPressEventArgs) Handles TextBoxPays.KeyPress ', TextBoxPrenom.KeyPress, TextBoxNom.KeyPress
  71.         e.Handled = VerifNotAlpha(e.KeyChar)
  72.     End Sub
  73.  
  74.     Function VerifNotAlpha(c As Char)
  75.         If Not Char.IsLetter(c) And c <> vbBack Then
  76.             Return True
  77.         End If
  78.         Return False
  79.  
  80.     End Function
  81.  
  82.     Private Sub arret_Click(sender As System.Object, e As System.EventArgs) Handles arret.Click
  83.         Dim reponse As MsgBoxResult
  84.         reponse = MsgBox("Voulez vous vraiment quitter ?", MsgBoxStyle.YesNo)
  85.         If reponse = MsgBoxResult.Yes Then
  86.             End
  87.  
  88.         End If
  89.  
  90.     End Sub
  91.  
  92.     Private Sub TextBox_LostFocus(sender As Object, e As System.EventArgs) Handles TextBoxNom.LostFocus, TextBoxPays.LostFocus, TextBoxPrenom.LostFocus
  93.         sender.Text = UCase(sender.Text)
  94.     End Sub
  95. End Class
  96.  
  97.  
  98. <Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
  99. Partial Class Form1
  100.     Inherits System.Windows.Forms.Form
  101.  
  102.     'Form remplace la méthode Dispose pour nettoyer la liste des composants.
  103.     <System.Diagnostics.DebuggerNonUserCode()> _
  104.     Protected Overrides Sub Dispose(ByVal disposing As Boolean)
  105.         Try
  106.             If disposing AndAlso components IsNot Nothing Then
  107.                 components.Dispose()
  108.             End If
  109.         Finally
  110.             MyBase.Dispose(disposing)
  111.         End Try
  112.     End Sub
  113.  
  114.     'Requise par le Concepteur Windows Form
  115.     Private components As System.ComponentModel.IContainer
  116.  
  117.     'REMARQUE : la procédure suivante est requise par le Concepteur Windows Form
  118.     'Elle peut être modifiée à l'aide du Concepteur Windows Form.  
  119.     'Ne la modifiez pas à l'aide de l'éditeur de code.
  120.     <System.Diagnostics.DebuggerStepThrough()> _
  121.     Private Sub InitializeComponent()
  122.         Me.RadioButton1 = New System.Windows.Forms.RadioButton()
  123.         Me.RadioButton2 = New System.Windows.Forms.RadioButton()
  124.         Me.RadioButton3 = New System.Windows.Forms.RadioButton()
  125.         Me.RadioButton4 = New System.Windows.Forms.RadioButton()
  126.         Me.RadioButton5 = New System.Windows.Forms.RadioButton()
  127.         Me.Nom = New System.Windows.Forms.Label()
  128.         Me.Prénom = New System.Windows.Forms.Label()
  129.         Me.CodePost = New System.Windows.Forms.Label()
  130.         Me.PanelGenre = New System.Windows.Forms.Panel()
  131.         Me.Panel2 = New System.Windows.Forms.Panel()
  132.         Me.PanelNom = New System.Windows.Forms.Panel()
  133.         Me.TextBoxPrenom = New System.Windows.Forms.TextBox()
  134.         Me.TextBoxNom = New System.Windows.Forms.TextBox()
  135.         Me.PanelCode = New System.Windows.Forms.Panel()
  136.         Me.TextBoxCode = New System.Windows.Forms.TextBox()
  137.         Me.arret = New System.Windows.Forms.Button()
  138.         Me.valid = New System.Windows.Forms.Button()
  139.         Me.Pays = New System.Windows.Forms.Label()
  140.         Me.TextBoxPays = New System.Windows.Forms.TextBox()
  141.         Me.PanelPays = New System.Windows.Forms.Panel()
  142.         Me.PanelGenre.SuspendLayout()
  143.         Me.Panel2.SuspendLayout()
  144.         Me.PanelNom.SuspendLayout()
  145.         Me.PanelCode.SuspendLayout()
  146.         Me.PanelPays.SuspendLayout()
  147.         Me.SuspendLayout()
  148.         '
  149.         'RadioButton1
  150.         '
  151.         Me.RadioButton1.AutoSize = True
  152.         Me.RadioButton1.Location = New System.Drawing.Point(16, 12)
  153.         Me.RadioButton1.Name = "RadioButton1"
  154.         Me.RadioButton1.Size = New System.Drawing.Size(60, 17)
  155.         Me.RadioButton1.TabIndex = 0
  156.         Me.RadioButton1.TabStop = True
  157.         Me.RadioButton1.Text = "option1"
  158.         Me.RadioButton1.UseVisualStyleBackColor = True
  159.         '
  160.         'RadioButton2
  161.         '
  162.         Me.RadioButton2.AutoSize = True
  163.         Me.RadioButton2.Location = New System.Drawing.Point(16, 36)
  164.         Me.RadioButton2.Name = "RadioButton2"
  165.         Me.RadioButton2.Size = New System.Drawing.Size(60, 17)
  166.         Me.RadioButton2.TabIndex = 1
  167.         Me.RadioButton2.TabStop = True
  168.         Me.RadioButton2.Text = "option1"
  169.         Me.RadioButton2.UseVisualStyleBackColor = True
  170.         '
  171.         'RadioButton3
  172.         '
  173.         Me.RadioButton3.AutoSize = True
  174.         Me.RadioButton3.Location = New System.Drawing.Point(16, 60)
  175.         Me.RadioButton3.Name = "RadioButton3"
  176.         Me.RadioButton3.Size = New System.Drawing.Size(60, 17)
  177.         Me.RadioButton3.TabIndex = 2
  178.         Me.RadioButton3.TabStop = True
  179.         Me.RadioButton3.Text = "option1"
  180.         Me.RadioButton3.UseVisualStyleBackColor = True
  181.         '
  182.         'RadioButton4
  183.         '
  184.         Me.RadioButton4.AutoSize = True
  185.         Me.RadioButton4.Checked = True
  186.         Me.RadioButton4.Location = New System.Drawing.Point(9, 11)
  187.         Me.RadioButton4.Name = "RadioButton4"
  188.         Me.RadioButton4.Size = New System.Drawing.Size(65, 17)
  189.         Me.RadioButton4.TabIndex = 3
  190.         Me.RadioButton4.TabStop = True
  191.         Me.RadioButton4.Text = "Français"
  192.         Me.RadioButton4.UseVisualStyleBackColor = True
  193.         '
  194.         'RadioButton5
  195.         '
  196.         Me.RadioButton5.AutoSize = True
  197.         Me.RadioButton5.Location = New System.Drawing.Point(9, 35)
  198.         Me.RadioButton5.Name = "RadioButton5"
  199.         Me.RadioButton5.Size = New System.Drawing.Size(65, 17)
  200.         Me.RadioButton5.TabIndex = 4
  201.         Me.RadioButton5.TabStop = True
  202.         Me.RadioButton5.Text = "Étranger"
  203.         Me.RadioButton5.UseVisualStyleBackColor = True
  204.         '
  205.         'Nom
  206.         '
  207.         Me.Nom.AutoSize = True
  208.         Me.Nom.Location = New System.Drawing.Point(12, 26)
  209.         Me.Nom.Name = "Nom"
  210.         Me.Nom.Size = New System.Drawing.Size(29, 13)
  211.         Me.Nom.TabIndex = 5
  212.         Me.Nom.Text = "Nom"
  213.         '
  214.         'Prénom
  215.         '
  216.         Me.Prénom.AutoSize = True
  217.         Me.Prénom.Location = New System.Drawing.Point(12, 52)
  218.         Me.Prénom.Name = "Prénom"
  219.         Me.Prénom.Size = New System.Drawing.Size(43, 13)
  220.         Me.Prénom.TabIndex = 6
  221.         Me.Prénom.Text = "Prénom"
  222.         '
  223.         'CodePost
  224.         '
  225.         Me.CodePost.AutoSize = True
  226.         Me.CodePost.Location = New System.Drawing.Point(13, 20)
  227.         Me.CodePost.Name = "CodePost"
  228.         Me.CodePost.Size = New System.Drawing.Size(64, 13)
  229.         Me.CodePost.TabIndex = 9
  230.         Me.CodePost.Text = "Code Postal"
  231.         '
  232.         'PanelGenre
  233.         '
  234.         Me.PanelGenre.Controls.Add(Me.RadioButton3)
  235.         Me.PanelGenre.Controls.Add(Me.RadioButton2)
  236.         Me.PanelGenre.Controls.Add(Me.RadioButton1)
  237.         Me.PanelGenre.Location = New System.Drawing.Point(95, 73)
  238.         Me.PanelGenre.Name = "PanelGenre"
  239.         Me.PanelGenre.Size = New System.Drawing.Size(121, 89)
  240.         Me.PanelGenre.TabIndex = 11
  241.         '
  242.         'Panel2
  243.         '
  244.         Me.Panel2.Controls.Add(Me.RadioButton5)
  245.         Me.Panel2.Controls.Add(Me.RadioButton4)
  246.         Me.Panel2.Location = New System.Drawing.Point(95, 183)
  247.         Me.Panel2.Name = "Panel2"
  248.         Me.Panel2.Size = New System.Drawing.Size(113, 60)
  249.         Me.Panel2.TabIndex = 12
  250.         '
  251.         'PanelNom
  252.         '
  253.         Me.PanelNom.Controls.Add(Me.TextBoxPrenom)
  254.         Me.PanelNom.Controls.Add(Me.TextBoxNom)
  255.         Me.PanelNom.Controls.Add(Me.Prénom)
  256.         Me.PanelNom.Controls.Add(Me.Nom)
  257.         Me.PanelNom.Location = New System.Drawing.Point(369, 73)
  258.         Me.PanelNom.Name = "PanelNom"
  259.         Me.PanelNom.Size = New System.Drawing.Size(199, 89)
  260.         Me.PanelNom.TabIndex = 13
  261.         '
  262.         'TextBoxPrenom
  263.         '
  264.         Me.TextBoxPrenom.Location = New System.Drawing.Point(100, 51)
  265.         Me.TextBoxPrenom.Name = "TextBoxPrenom"
  266.         Me.TextBoxPrenom.Size = New System.Drawing.Size(100, 20)
  267.         Me.TextBoxPrenom.TabIndex = 8
  268.         '
  269.         'TextBoxNom
  270.         '
  271.         Me.TextBoxNom.Location = New System.Drawing.Point(100, 26)
  272.         Me.TextBoxNom.Name = "TextBoxNom"
  273.         Me.TextBoxNom.Size = New System.Drawing.Size(100, 20)
  274.         Me.TextBoxNom.TabIndex = 7
  275.         '
  276.         'PanelCode
  277.         '
  278.         Me.PanelCode.Controls.Add(Me.TextBoxCode)
  279.         Me.PanelCode.Controls.Add(Me.CodePost)
  280.         Me.PanelCode.Location = New System.Drawing.Point(369, 183)
  281.         Me.PanelCode.Name = "PanelCode"
  282.         Me.PanelCode.Size = New System.Drawing.Size(201, 40)
  283.         Me.PanelCode.TabIndex = 14
  284.         '
  285.         'TextBoxCode
  286.         '
  287.         Me.TextBoxCode.Location = New System.Drawing.Point(98, 13)
  288.         Me.TextBoxCode.MaxLength = 5
  289.         Me.TextBoxCode.Name = "TextBoxCode"
  290.         Me.TextBoxCode.Size = New System.Drawing.Size(100, 20)
  291.         Me.TextBoxCode.TabIndex = 10
  292.         '
  293.         'arret
  294.         '
  295.         Me.arret.Location = New System.Drawing.Point(104, 349)
  296.         Me.arret.Name = "arret"
  297.         Me.arret.Size = New System.Drawing.Size(75, 23)
  298.         Me.arret.TabIndex = 15
  299.         Me.arret.Text = "Arrêt"
  300.         Me.arret.UseVisualStyleBackColor = True
  301.         '
  302.         'valid
  303.         '
  304.         Me.valid.Location = New System.Drawing.Point(369, 349)
  305.         Me.valid.Name = "valid"
  306.         Me.valid.Size = New System.Drawing.Size(75, 23)
  307.         Me.valid.TabIndex = 16
  308.         Me.valid.Text = "Validation"
  309.         Me.valid.UseVisualStyleBackColor = True
  310.         '
  311.         'Pays
  312.         '
  313.         Me.Pays.AutoSize = True
  314.         Me.Pays.Location = New System.Drawing.Point(13, 17)
  315.         Me.Pays.Name = "Pays"
  316.         Me.Pays.Size = New System.Drawing.Size(30, 13)
  317.         Me.Pays.TabIndex = 17
  318.         Me.Pays.Text = "Pays"
  319.         '
  320.         'TextBoxPays
  321.         '
  322.         Me.TextBoxPays.Location = New System.Drawing.Point(100, 10)
  323.         Me.TextBoxPays.Name = "TextBoxPays"
  324.         Me.TextBoxPays.Size = New System.Drawing.Size(100, 20)
  325.         Me.TextBoxPays.TabIndex = 18
  326.         '
  327.         'PanelPays
  328.         '
  329.         Me.PanelPays.Controls.Add(Me.TextBoxPays)
  330.         Me.PanelPays.Controls.Add(Me.Pays)
  331.         Me.PanelPays.Location = New System.Drawing.Point(369, 229)
  332.         Me.PanelPays.Name = "PanelPays"
  333.         Me.PanelPays.Size = New System.Drawing.Size(201, 39)
  334.         Me.PanelPays.TabIndex = 19
  335.         Me.PanelPays.Visible = False
  336.         '
  337.         'Form1
  338.         '
  339.         Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
  340.         Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
  341.         Me.ClientSize = New System.Drawing.Size(706, 448)
  342.         Me.Controls.Add(Me.PanelPays)
  343.         Me.Controls.Add(Me.valid)
  344.         Me.Controls.Add(Me.arret)
  345.         Me.Controls.Add(Me.PanelCode)
  346.         Me.Controls.Add(Me.PanelNom)
  347.         Me.Controls.Add(Me.Panel2)
  348.         Me.Controls.Add(Me.PanelGenre)
  349.         Me.Name = "Form1"
  350.         Me.Text = "Form1"
  351.         Me.PanelGenre.ResumeLayout(False)
  352.         Me.PanelGenre.PerformLayout()
  353.         Me.Panel2.ResumeLayout(False)
  354.         Me.Panel2.PerformLayout()
  355.         Me.PanelNom.ResumeLayout(False)
  356.         Me.PanelNom.PerformLayout()
  357.         Me.PanelCode.ResumeLayout(False)
  358.         Me.PanelCode.PerformLayout()
  359.         Me.PanelPays.ResumeLayout(False)
  360.         Me.PanelPays.PerformLayout()
  361.         Me.ResumeLayout(False)
  362.  
  363.     End Sub
  364.     Friend WithEvents RadioButton1 As System.Windows.Forms.RadioButton
  365.     Friend WithEvents RadioButton2 As System.Windows.Forms.RadioButton
  366.     Friend WithEvents RadioButton3 As System.Windows.Forms.RadioButton
  367.     Friend WithEvents RadioButton4 As System.Windows.Forms.RadioButton
  368.     Friend WithEvents RadioButton5 As System.Windows.Forms.RadioButton
  369.     Friend WithEvents Nom As System.Windows.Forms.Label
  370.     Friend WithEvents Prénom As System.Windows.Forms.Label
  371.     Friend WithEvents CodePost As System.Windows.Forms.Label
  372.     Friend WithEvents PanelGenre As System.Windows.Forms.Panel
  373.     Friend WithEvents Panel2 As System.Windows.Forms.Panel
  374.     Friend WithEvents PanelNom As System.Windows.Forms.Panel
  375.     Friend WithEvents TextBoxPrenom As System.Windows.Forms.TextBox
  376.     Friend WithEvents TextBoxNom As System.Windows.Forms.TextBox
  377.     Friend WithEvents PanelCode As System.Windows.Forms.Panel
  378.     Friend WithEvents TextBoxCode As System.Windows.Forms.TextBox
  379.     Friend WithEvents arret As System.Windows.Forms.Button
  380.     Friend WithEvents valid As System.Windows.Forms.Button
  381.     Friend WithEvents Pays As System.Windows.Forms.Label
  382.     Friend WithEvents TextBoxPays As System.Windows.Forms.TextBox
  383.     Friend WithEvents PanelPays As System.Windows.Forms.Panel
  384.  
  385. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement