IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

VB.NET Discussion :

Passer tout une case de formulaire en majuscule.


Sujet :

VB.NET

  1. #1
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Juillet 2007
    Messages
    117
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2007
    Messages : 117
    Points : 29
    Points
    29
    Par défaut Mettre la premiere lettre d'une Textbox en majuscule
    Bonjour.
    Je suis débutante en vb, mais je suis ammenée à toucher à du code. Et il me faut manipuler un bout pour passer un Nom en majuscule automatiquement.
    Pour le moment, on tape le nom et seulement la premiere lettre se met en majuscule automatiquement. J'aimerais savoir comment tout passer en majuscule.

    Voici le morceau de code:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    Public Sub Nom_cdtTextBox_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Nom_cdtTextBox.KeyPress
            Dim pos As Integer
            pos = Nom_cdtTextBox.SelectionStart
            If Nom_cdtTextBox.SelectionStart = 0 Then
                If e.KeyChar = "a" Then
                    e.Handled = True
                    Nom_cdtTextBox.Text = Nom_cdtTextBox.Text.Insert(pos, "A")
                End If
                If e.KeyChar = "b" Then
                    e.Handled = True
                   Nom_cdtTextBox.Text = Nom_cdtTextBox.Text.Insert(pos, "B")
               End If
    ...
                If e.KeyChar = "y" Then
                    e.Handled = True
                    Nom_cdtTextBox.Text = Nom_cdtTextBox.Text.Insert(pos, "Y")
                End If
                If e.KeyChar = "z" Then
                    e.Handled = True
                    Nom_cdtTextBox.Text = Nom_cdtTextBox.Text.Insert(pos, "Z")
                End If
                Nom_cdtTextBox.SelectionStart = pos + 1 'on avance le curseur d'un caractère
            End If
     
            Dim pos2 As String
            pos2 = UCase(Nom_cdtTextBox) 'renvoie le tout en majuscule
        End Sub

  2. #2
    Membre régulier
    Profil pro
    Inscrit en
    Juillet 2007
    Messages
    115
    Détails du profil
    Informations personnelles :
    Âge : 35
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Juillet 2007
    Messages : 115
    Points : 110
    Points
    110
    Par défaut
    Salut Lutine, essaye ceci :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            TextBox1.CharacterCasing = CharacterCasing.Upper
     
        End Sub

  3. #3
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Juillet 2007
    Messages
    117
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2007
    Messages : 117
    Points : 29
    Points
    29
    Par défaut
    Hm, il me dit qu'il ne connais pas l'évenement load...

    Je dois faire comment?

  4. #4
    Membre confirmé
    Inscrit en
    Juin 2007
    Messages
    459
    Détails du profil
    Informations forums :
    Inscription : Juin 2007
    Messages : 459
    Points : 553
    Points
    553
    Par défaut
    Défini plutôt ta propriété Nom_cdtTextBox.CharacterCasing à l'endroit où tu crées ta TextBox et affecte ses autres propriétés.

  5. #5
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Juillet 2007
    Messages
    117
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2007
    Messages : 117
    Points : 29
    Points
    29
    Par défaut
    Merci beaucoup !

    Ca marche comme je le souhaite maintenant

  6. #6
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Juillet 2007
    Messages
    117
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2007
    Messages : 117
    Points : 29
    Points
    29
    Par défaut
    Quelqu'un saurait comment alléger le premier code que j'ai mis, afin de mettre que la premiere lettre tapée dans la textbox en majuscule?

  7. #7
    Expert éminent sénior Avatar de Pol63
    Homme Profil pro
    .NET / SQL SERVER
    Inscrit en
    Avril 2007
    Messages
    14 154
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Puy de Dôme (Auvergne)

    Informations professionnelles :
    Activité : .NET / SQL SERVER

    Informations forums :
    Inscription : Avril 2007
    Messages : 14 154
    Points : 25 072
    Points
    25 072
    Par défaut
    sur l'evenement textchanged
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
     
    dim ch as string
    ch = ucase(left(textbox1.text,1))
    ch = ch & lcase(right(textbox1.text,len(textbox1.text)-1))
    textbox1.text = ch
    Cours complets, tutos et autres FAQ ici : C# - VB.NET

  8. #8
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Juillet 2007
    Messages
    117
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2007
    Messages : 117
    Points : 29
    Points
    29
    Par défaut
    Merci de ta réponse,

    mais j'ai un erreur:

    'Public Property Left() As Integer' n'a aucun paramètre et son type de retour ne peut pas être indexé.

    Remarque, j'ai la meme pour Right

    Comment la réparer?

  9. #9
    Expert éminent sénior Avatar de Pol63
    Homme Profil pro
    .NET / SQL SERVER
    Inscrit en
    Avril 2007
    Messages
    14 154
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Puy de Dôme (Auvergne)

    Informations professionnelles :
    Activité : .NET / SQL SERVER

    Informations forums :
    Inscription : Avril 2007
    Messages : 14 154
    Points : 25 072
    Points
    25 072
    Par défaut
    en mettant microsoft.visualbasic. devant
    pour que ca fasse microsoft.visualbasic.left et microsoft.visualbasic.right
    sinon il veut utiliser un autre left qui ne fait pas du tout la meme chose
    Cours complets, tutos et autres FAQ ici : C# - VB.NET

  10. #10
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Juillet 2007
    Messages
    117
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2007
    Messages : 117
    Points : 29
    Points
    29
    Par défaut
    Le code ne pose plus d'erreur, mais ne marche pas. :/

    Une solution?

  11. #11
    Expert éminent sénior Avatar de Pol63
    Homme Profil pro
    .NET / SQL SERVER
    Inscrit en
    Avril 2007
    Messages
    14 154
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Puy de Dôme (Auvergne)

    Informations professionnelles :
    Activité : .NET / SQL SERVER

    Informations forums :
    Inscription : Avril 2007
    Messages : 14 154
    Points : 25 072
    Points
    25 072
    Par défaut
    fait voir ton code
    Cours complets, tutos et autres FAQ ici : C# - VB.NET

  12. #12
    Expert confirmé
    Avatar de Aspic
    Homme Profil pro
    Étudiant
    Inscrit en
    Août 2005
    Messages
    3 905
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Hauts de Seine (Île de France)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Électronique et micro-électronique

    Informations forums :
    Inscription : Août 2005
    Messages : 3 905
    Points : 4 388
    Points
    4 388
    Par défaut
    Utilise ce code :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    UCase(Microsoft.VisualBasic.Left(Text_Box.ToString, 1)) & LCase(Microsoft.VisualBasic.Right(Text_Box.ToString, Len(Text_Box.ToString) - 1))
    Qui ne tente rien n'a rien !
    Ce qui ne nous tue pas nous rends plus fort !!
    Mon projet ZELDA en C++/Allegro
    http://www.tutoworld.com - Le Forum -
    Mes ressources Dotnet (cours, sources, tutos)
    --------------------------------------------
    + + =

    Ne pas oublier le Tag !

  13. #13
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Juillet 2007
    Messages
    117
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2007
    Messages : 117
    Points : 29
    Points
    29
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    475
    476
    477
    478
    479
    480
    481
    482
    483
    484
    485
    486
    487
    488
    489
    490
    491
    492
    493
    494
    495
    496
    497
    498
    499
    500
    501
    502
    503
    504
    505
    506
    507
    508
    509
    510
    511
    512
    513
    Imports System.Drawing
    Imports System.Collections
    Imports System.ComponentModel
    Imports System.Windows.Forms
    Imports System.Data
    Imports System.Runtime.InteropServices
    Imports System.Threading
    Public Class Form1
        Public bmb As BindingManagerBase
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            'TODO : cette ligne de code charge les données dans la table 'BaseDataSet.Donnees'. Vous pouvez la déplacer ou la supprimer selon vos besoins.
            Me.DonneesTableAdapter.Fill(Me.BaseDataSet.Donnees)
            'TODO : cette ligne de code charge les données dans la table 'BaseDataSet.Donnees'. Vous pouvez la déplacer ou la supprimer selon vos besoins.
            Me.DonneesTableAdapter.Fill(Me.BaseDataSet.Donnees)
            'TODO : cette ligne de code charge les données dans la table 'BaseDataSet.Donnees'. Vous pouvez la déplacer ou la supprimer selon vos besoins.
            Me.DonneesTableAdapter.Fill(Me.BaseDataSet.Donnees)
            'TODO : cette ligne de code charge les données dans la table 'BaseDataSet.Donnees'. Vous pouvez la déplacer ou la supprimer selon vos besoins.
            Me.DonneesTableAdapter.Fill(Me.BaseDataSet.Donnees)
            bmb = Me.BindingContext(Me.DonneesBindingSource)
            My.Forms.LoginForm1.Visible = False
            Me.ToolStripStatusLabel1.Text = "Société :"
            Me.ToolStripStatusLabel2.Text = My.Application.Info.ProductName
            Me.ToolStripStatusLabel3.Text = "| Utilisateur :"
            Me.ToolStripStatusLabel4.Text = My.Forms.LoginForm1.UsernameTextBox.Text
            Me.ToolStripStatusLabel5.Text = "| Ouverture du programme à :"
            Me.ToolStripStatusLabel6.Text = My.Computer.Clock.LocalTime
            Me.MinimizeBox = True
            Me.MaximizeBox = True
            Me.HelpButton = True
     
        End Sub
        Private Sub NouveauToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NouveauToolStripMenuItem.Click
            Me.bmb.AddNew()
            Me.Langue1_cdtComboBox.Text = "Anglais"
        End Sub
        Private Sub SupprimerToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SupprimerToolStripMenuItem.Click
            If MsgBox("Etes-vous sur de vouloir supprimer ce candidat", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
                Try
                    Me.bmb.RemoveAt(Me.bmb.Position)
                    MsgBox("Element supprimé")
                Catch ex As Exception
                    MsgBox("Erreur de suppression:" & vbCr & ex.Message)
                End Try
            End If
        End Sub
     
        Private Sub EnregistrerToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EnregistrerToolStripMenuItem.Click
            Me.Validate()
            Me.DonneesBindingSource.EndEdit()
            Me.DonneesTableAdapter.Update(Me.BaseDataSet.Donnees)
        End Sub
     
        Private Sub ImprimerToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ImprimerToolStripMenuItem.Click
            Me.bmb.Position -= 1
        End Sub
     
        Private Sub QuitterToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles QuitterToolStripMenuItem.Click
            Me.bmb.Position += 1
        End Sub
     
        Private Sub QuitterToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles QuitterToolStripMenuItem1.Click
            Me.Close()
            My.Forms.LoginForm1.Close()
        End Sub
        Private Sub RechercheToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RechercheToolStripMenuItem.Click
            Dim Form2 As New Recherche
            Recherche.ShowDialog()
     
        End Sub
     
        Private Sub AjouterUnUtilisateurToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AjouterUnUtilisateurToolStripMenuItem.Click
            If (My.Forms.LoginForm1.UsernameTextBox.Text = "admin") Then
                Dim AjoutU As New AjouterUtilisateur
                AjoutU.ShowDialog()
            Else
                MsgBox("Vous n'êtes pas administrateur du logiciel")
            End If
        End Sub
        Public Function afficher_element(ByVal valeur As String)
            Dim i As Integer
            Dim pourcent As Integer
     
            Dim bOk As Boolean = False
            If (valeur < 5000) Then
                Me.DonneesBindingSource.Position = valeur - 25
            Else
                Me.DonneesBindingSource.Position = 4056 + (valeur - 18280) - 30
            End If
     
            For i = 0 To Me.DonneesBindingSource.Count Step 1
                pourcent = (i / (Me.DonneesBindingSource.Count)) * 100
                If (i = 0) Then
                    My.Forms.Recherche.ProgressBar1.Increment(-100)
                Else
                    My.Forms.Recherche.ProgressBar1.Increment(pourcent)
                End If
                My.Forms.Recherche.ProgressBar1.Increment(pourcent)
                If (valeur = Me.Num_cdtLabel1.Text) Then
                    bOk = True
                    My.Forms.Recherche.ProgressBar1.Increment(100)
                    i = Me.DonneesBindingSource.Count
                Else
                    Me.DonneesBindingSource.MoveNext()
     
                End If
            Next
            Return bOk
     
        End Function
        Private Sub DonneesBindingNavigatorSaveItem_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DonneesBindingNavigatorSaveItem.Click
            Me.Validate()
            Me.DonneesBindingSource.EndEdit()
     
            Me.DonneesTableAdapter.Update(Me.BaseDataSet.Donnees)
     
        End Sub
        Private Sub AjouterUnEtatCivilToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AjouterUnEtatCivilToolStripMenuItem.Click
            If (My.Forms.LoginForm1.UsernameTextBox.Text = "admin") Then
                Dim AjoutE As New AjoutEtatCivil
                AjoutE.ShowDialog()
            Else
                MsgBox("Vous n'êtes pas administrateur du logiciel")
            End If
        End Sub
     
        Private Sub AjouterOuSupprimerUneNationalitéToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AjouterOuSupprimerUneNationalitéToolStripMenuItem.Click
            If (My.Forms.LoginForm1.UsernameTextBox.Text = "admin") Then
                Dim AjoutNa As New AjoutNationalite
                AjoutNa.ShowDialog()
            Else
                MsgBox("Vous n'êtes pas administrateur du logiciel")
            End If
        End Sub
     
        Private Sub AjouterOuSupprimerUneNoteToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AjouterOuSupprimerUneNoteToolStripMenuItem.Click
            If (My.Forms.LoginForm1.UsernameTextBox.Text = "admin") Then
                Dim AjoutN As New Ajoutnote
                AjoutN.ShowDialog()
            Else
                MsgBox("Vous n'êtes pas administrateur du logiciel")
            End If
        End Sub
     
        Private Sub AjouterOuSuprimerUnNiveauDeLangueToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AjouterOuSuprimerUnNiveauDeLangueToolStripMenuItem.Click
            If (My.Forms.LoginForm1.UsernameTextBox.Text = "admin") Then
                Dim AjoutNivo As New Ajoutnivolangue
                AjoutNivo.ShowDialog()
            Else
                MsgBox("Vous n'êtes pas administrateur du logiciel")
            End If
        End Sub
        Private Sub AjouterOuSuprimerUneLangueToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AjouterOuSuprimerUneLangueToolStripMenuItem.Click
            If (My.Forms.LoginForm1.UsernameTextBox.Text = "admin") Then
                Dim AjoutLge As New AjoutLangue
                AjoutLangue.ShowDialog()
            Else
                MsgBox("Vous n'êtes pas administrateur du logiciel")
            End If
        End Sub
        Private Sub FermerEtOuvrirUneNouvelleSessionToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FermerEtOuvrirUneNouvelleSessionToolStripMenuItem.Click
            Me.Close()
            My.Forms.LoginForm1.Show()
            My.Forms.LoginForm1.UsernameTextBox.Text = ""
            My.Forms.LoginForm1.PasswordTextBox.Text = ""
        End Sub
     
        Private Sub ImrpimerToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ImrpimerToolStripMenuItem.Click
            Dim impression As New Form2
            Form2.ShowDialog()
        End Sub
     
     
     
        Public Sub Societe_cdtTextbox_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Societe_cdtTextBox.KeyPress
     
            Dim pos As Integer
     
            pos = Societe_cdtTextBox.SelectionStart
     
            If Societe_cdtTextBox.SelectionStart = 0 Then
     
                If e.KeyChar = "a" Then
     
                    e.Handled = True
     
                    Societe_cdtTextBox.Text = Societe_cdtTextBox.Text.Insert(pos, "A")
     
                End If
     
                If e.KeyChar = "b" Then
     
                    e.Handled = True
     
                    Societe_cdtTextBox.Text = Societe_cdtTextBox.Text.Insert(pos, "B")
     
                End If
    ...
     
                If e.KeyChar = "z" Then
     
                    e.Handled = True
     
                    Societe_cdtTextBox.Text = Societe_cdtTextBox.Text.Insert(pos, "Z")
     
                End If
     
                Societe_cdtTextBox.SelectionStart = pos + 1 'on avance le curseur d'un caractère
     
            End If
     
        End Sub
        Public Sub Souhaits_cdtTextbox_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Souhaits_cdtTextbox.KeyPress
     
            Dim pos As Integer
     
            pos = Souhaits_cdtTextbox.SelectionStart
     
            If Souhaits_cdtTextbox.SelectionStart = 0 Then
     
                If e.KeyChar = "a" Then
     
                    e.Handled = True
     
                    Souhaits_cdtTextbox.Text = Souhaits_cdtTextbox.Text.Insert(pos, "A")
     
                End If
     
                ...
     
                If e.KeyChar = "x" Then
     
                    e.Handled = True
     
                    Souhaits_cdtTextbox.Text = Souhaits_cdtTextbox.Text.Insert(pos, "X")
     
                End If
     
                If e.KeyChar = "y" Then
     
                    e.Handled = True
     
                    Souhaits_cdtTextbox.Text = Souhaits_cdtTextbox.Text.Insert(pos, "Y")
     
                End If
     
                If e.KeyChar = "z" Then
     
                    e.Handled = True
     
                    Souhaits_cdtTextbox.Text = Souhaits_cdtTextbox.Text.Insert(pos, "Z")
     
                End If
     
                Souhaits_cdtTextbox.SelectionStart = pos + 1 'on avance le curseur d'un caractère
     
            End If
     
        End Sub
        Public Sub Competences_cdtTextbox_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs)
     
            Dim pos As Integer
     
            pos = Competences_cdtTextBox.SelectionStart
     
            If Competences_cdtTextBox.SelectionStart = 0 Then
     
                If e.KeyChar = "a" Then
     
                    e.Handled = True
     
                    Competences_cdtTextBox.Text = Competences_cdtTextBox.Text.Insert(pos, "A")
     
                End If
     
                If e.KeyChar = "b" Then
     
                    e.Handled = True
     
                    Competences_cdtTextBox.Text = Competences_cdtTextBox.Text.Insert(pos, "B")
     
                End If
     
               ...
     
                If e.KeyChar = "y" Then
     
                    e.Handled = True
     
                    Competences_cdtTextBox.Text = Competences_cdtTextBox.Text.Insert(pos, "Y")
     
                End If
     
                If e.KeyChar = "z" Then
     
                    e.Handled = True
     
                    Competences_cdtTextBox.Text = Competences_cdtTextBox.Text.Insert(pos, "Z")
     
                End If
     
                Competences_cdtTextBox.SelectionStart = pos + 1 'on avance le curseur d'un caractère
     
            End If
     
        End Sub
     
     
        Private Sub Pretention_salTextBox_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Pretention_salTextBox.Validating
     
            If Not IsNumeric(Me.Pretention_salTextBox.Text) Then
     
                Me.ErrorProvider1.SetError(Me.Pretention_salTextBox, "L'entrée doit être numérique")
     
                e.Cancel = True
     
            Else
     
                Me.ErrorProvider1.SetError(Me.Pretention_salTextBox, "")
     
            End If
     
        End Sub
        Private Sub Actuel_salTextBox_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Actuel_salTextBox.Validating
     
            If Not IsNumeric(Me.Actuel_salTextBox.Text) Then
     
                Me.ErrorProvider1.SetError(Me.Actuel_salTextBox, "L'entrée doit être numérique")
     
                e.Cancel = True
     
            Else
     
                Me.ErrorProvider1.SetError(Me.Actuel_salTextBox, "")
     
            End If
     
        End Sub
        Private Sub Pretention2_salTextBox_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Pretention2_salTextBox.Validating
     
            If Not IsNumeric(Me.Pretention2_salTextBox.Text) Then
     
                Me.ErrorProvider1.SetError(Me.Pretention2_salTextBox, "L'entrée doit être numérique")
     
                e.Cancel = True
     
            Else
     
                Me.ErrorProvider1.SetError(Me.Pretention2_salTextBox, "")
     
            End If
     
        End Sub
        Private Sub Fixe_cdtTextBox_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Fixe_cdtTextBox.Validating
     
            If Not IsNumeric(Me.Fixe_cdtTextBox.Text) Then
     
                Me.ErrorProvider1.SetError(Me.Fixe_cdtTextBox, "L'entrée doit être numérique")
     
                e.Cancel = True
     
            Else
     
                Me.ErrorProvider1.SetError(Me.Fixe_cdtTextBox, "")
     
            End If
     
        End Sub
        Private Sub Actuel2_salTextBox_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Actuel2_salTextBox.Validating
     
            If Not IsNumeric(Me.Actuel2_salTextBox.Text) Then
     
                Me.ErrorProvider1.SetError(Me.Actuel2_salTextBox, "L'entrée doit être numérique")
     
                e.Cancel = True
     
            Else
     
                Me.ErrorProvider1.SetError(Me.Actuel2_salTextBox, "")
     
            End If
     
        End Sub
        Private Sub Mobile_cdtTextBox_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs)
     
            If Not IsNumeric(Me.Mobile_cdtTextBox.Text) Then
     
                Me.ErrorProvider1.SetError(Me.Mobile_cdtTextBox, "L'entrée doit être numérique")
     
                e.Cancel = True
     
            Else
     
                Me.ErrorProvider1.SetError(Me.Mobile_cdtTextBox, "")
     
            End If
     
        End Sub
     
        Private Sub Nom_cdtTextBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Nom_cdtTextBox.TextChanged
     
        End Sub
        Private Sub Prenom_cdtTextBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Nom_cdtTextBox.TextChanged
     
            Dim ch As String
            ch = UCase(Microsoft.VisualBasic.Left(Prenom_cdtTextBox.Text, 1))
            ch = ch & LCase(Microsoft.VisualBasic.Right(Prenom_cdtTextBox.Text, Len(Prenom_cdtTextBox.Text) - 1))
            Prenom_cdtTextBox.Text = ch
        End Sub
     
        Private Sub Actuel_salLabel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
     
        End Sub
     
        Private Sub Global_cdtLabel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
     
        End Sub
     
        Private Sub ExpOrale_cdtComboBox_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExpOrale_cdtComboBox.SelectedIndexChanged
     
        End Sub
     
        Private Sub Global_cdtComboBox_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Global_cdtComboBox.SelectedIndexChanged
     
        End Sub
     
        Private Sub Motivation_cdtComboBox_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Motivation_cdtComboBox.SelectedIndexChanged
     
        End Sub
     
        Private Sub Relationnel_cdtLabel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
     
        End Sub
     
        Private Sub Presentation_cdtLabel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
     
        End Sub
     
        Private Sub Mobilite_cdtLabel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
     
        End Sub
     
        Private Sub ExpOrale_cdtLabel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
     
        End Sub
     
        Private Sub Habilitation_cdtLabel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
     
        End Sub
     
        Private Sub Habilitation_cdtTextBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Habilitation_cdtTextBox.TextChanged
     
        End Sub
     
        Private Sub Souhaits_cdtLabel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
     
        End Sub
     
        Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Souhaits_cdtTextbox.TextChanged
     
        End Sub
     
        Private Sub Mobile_cdtTextBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
     
        End Sub
     
        Private Sub Niveau1_cdtComboBox_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Niveau1_cdtComboBox.SelectedIndexChanged
     
        End Sub
     
        Private Sub Langue2_cdtComboBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
     
        End Sub
     
        Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Langue3_cdtComboBox.SelectedIndexChanged
     
        End Sub
     
        Private Sub TabPage3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TabPage3.Click
     
        End Sub
     
        Private Sub Langue1_cdtComboBox_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Langue1_cdtComboBox.SelectedIndexChanged
     
        End Sub
        Private Sub Vuele_autDateTimePicker_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Vuele_autCheckBox.Click
            If Vuele_autCheckBox.Checked = True Then
                Vuele_autDateTimePicker.Enabled = True 'pour activer
            Else
                Vuele_autDateTimePicker.Enabled = False 'pour désactiver
            End If
     
        End Sub
        Private Sub Depuis_cdtDateTimePicker_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Depuis_cdtCheckBox.Click
            If Depuis_cdtCheckBox.Checked = True Then
                Depuis_cdtDateTimePicker.Enabled = True 'pour activer
            Else
                Depuis_cdtDateTimePicker.Enabled = False 'pour désactiver
            End If
     
        End Sub
     
        Private Sub Contactencours_cdtTextBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Contactencours_cdtTextBox.TextChanged
     
        End Sub
     
        Private Sub TabPage5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TabPage5.Click
     
        End Sub
     
        Private Sub Rdvtel2_autLabel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
     
        End Sub
    End Class

    Pfiou.. C'est ma form1.vb
    Là oiù ya les '...' c'est que c'est la meme chose de 'a' à 'z'. J'ai aussi enlevé un bout de code qui se répète en fait (la facon de mettre en majuscule la premiere lettre, pour d'autres textbox).

    J'ai utilisé ta méthode pour la textbox du prénom

    Si tu trouve comment faire..

    Et j'ai aussi un probleme avec l'enregistrement. J'arrive pas à enregistrer chaque fiche candidats quand j'appuis dans le menu sur le l'icone enregistrer.

    Ca doit etre à cause d'un dataset qui marche pas..

  14. #14
    Expert confirmé
    Avatar de Aspic
    Homme Profil pro
    Étudiant
    Inscrit en
    Août 2005
    Messages
    3 905
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Hauts de Seine (Île de France)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Électronique et micro-électronique

    Informations forums :
    Inscription : Août 2005
    Messages : 3 905
    Points : 4 388
    Points
    4 388
    Par défaut
    Tu as essayé avec mon code ? biensur à adapter avec le nom de ta textbox !
    Qui ne tente rien n'a rien !
    Ce qui ne nous tue pas nous rends plus fort !!
    Mon projet ZELDA en C++/Allegro
    http://www.tutoworld.com - Le Forum -
    Mes ressources Dotnet (cours, sources, tutos)
    --------------------------------------------
    + + =

    Ne pas oublier le Tag !

  15. #15
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Juillet 2007
    Messages
    117
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2007
    Messages : 117
    Points : 29
    Points
    29
    Par défaut
    Oui j'ai essayé. Mais ca marche pas non plus. -_-

    Prise de tete !!

  16. #16
    Expert éminent sénior Avatar de Pol63
    Homme Profil pro
    .NET / SQL SERVER
    Inscrit en
    Avril 2007
    Messages
    14 154
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Puy de Dôme (Auvergne)

    Informations professionnelles :
    Activité : .NET / SQL SERVER

    Informations forums :
    Inscription : Avril 2007
    Messages : 14 154
    Points : 25 072
    Points
    25 072
    Par défaut
    moi je voulais voir ton code avec une de nos implémentations
    car faire du code qui vérifie si c'est a b c etc... c'est pas du développement, c'est du nimp
    Cours complets, tutos et autres FAQ ici : C# - VB.NET

  17. #17
    Expert confirmé
    Avatar de Aspic
    Homme Profil pro
    Étudiant
    Inscrit en
    Août 2005
    Messages
    3 905
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Hauts de Seine (Île de France)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Électronique et micro-électronique

    Informations forums :
    Inscription : Août 2005
    Messages : 3 905
    Points : 4 388
    Points
    4 388
    Par défaut
    Citation Envoyé par Lutine
    Oui j'ai essayé. Mais ca marche pas non plus. -_-

    Prise de tete !!
    Marche très bien chez moi mets la premiere lettre de ta textbox en majuscule !
    Qui ne tente rien n'a rien !
    Ce qui ne nous tue pas nous rends plus fort !!
    Mon projet ZELDA en C++/Allegro
    http://www.tutoworld.com - Le Forum -
    Mes ressources Dotnet (cours, sources, tutos)
    --------------------------------------------
    + + =

    Ne pas oublier le Tag !

  18. #18
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Juillet 2007
    Messages
    117
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2007
    Messages : 117
    Points : 29
    Points
    29
    Par défaut
    Ce code, c'est du nimp, je sais, c'est pas moi qui l'ai écrit. Moi j'ai été embauchée pour justement l'améliorer, mais je débute en vb, c'est le but su stage.


    Et si tu regarde bien mon code, il y a ton implication dedans..

    Donc s'il vous plait.. Aidez moi !

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
        Private Sub Prenom_cdtTextBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Nom_cdtTextBox.TextChanged
     
            Dim ch As String
            ch = UCase(Microsoft.VisualBasic.Left(Prenom_cdtTextBox.Text, 1))
            ch = ch & LCase(Microsoft.VisualBasic.Right(Prenom_cdtTextBox.Text, Len(Prenom_cdtTextBox.Text) - 1))
            Prenom_cdtTextBox.Text = ch
        End Sub
    Tiens, je t'ai isolé ton implication



    Aspic > Comment utiliser ton code?

  19. #19
    Expert éminent sénior Avatar de Pol63
    Homme Profil pro
    .NET / SQL SERVER
    Inscrit en
    Avril 2007
    Messages
    14 154
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Puy de Dôme (Auvergne)

    Informations professionnelles :
    Activité : .NET / SQL SERVER

    Informations forums :
    Inscription : Avril 2007
    Messages : 14 154
    Points : 25 072
    Points
    25 072
    Par défaut
    Citation Envoyé par Lutine
    Ce code, c'est du nimp, je sais, c'est pas moi qui l'ai écrit. Moi j'ai été embauchée pour justement l'améliorer, mais je débute en vb, c'est le but su stage.


    Et si tu regarde bien mon code, il y a ton implication dedans..

    Donc s'il vous plait.. Aidez moi !

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
        Private Sub Prenom_cdtTextBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Nom_cdtTextBox.TextChanged
     
            Dim ch As String
            ch = UCase(Microsoft.VisualBasic.Left(Prenom_cdtTextBox.Text, 1))
            ch = ch & LCase(Microsoft.VisualBasic.Right(Prenom_cdtTextBox.Text, Len(Prenom_cdtTextBox.Text) - 1))
            Prenom_cdtTextBox.Text = ch
        End Sub
    Tiens, je t'ai isolé ton implication



    Aspic > Comment utiliser ton code?

    lol

    bref
    si tu supprimes pas le reste aussi ...
    Cours complets, tutos et autres FAQ ici : C# - VB.NET

  20. #20
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Juillet 2007
    Messages
    117
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2007
    Messages : 117
    Points : 29
    Points
    29
    Par défaut
    Celui du prénom, j'ai supprimé.

    Et en remplacant pas ton code, il me m'inscrit dans la Textbox du prénom :
    "System.windows.forms.textbox, text: "

+ Répondre à la discussion
Cette discussion est résolue.
Page 1 sur 3 123 DernièreDernière

Discussions similaires

  1. [AC-2010] bouton commande tout sélectionner case à cocher formulaire
    Par paulux67 dans le forum IHM
    Réponses: 8
    Dernier message: 08/08/2012, 08h16
  2. comment passer d'une midlet à un formulaire à une alerte en J2ME
    Par elhechmi dans le forum Développement Mobile en Java
    Réponses: 1
    Dernier message: 03/04/2010, 17h16
  3. Réponses: 2
    Dernier message: 09/12/2008, 19h09
  4. passer toute une partie de code en commentaire
    Par schwarzy2 dans le forum VBA Access
    Réponses: 4
    Dernier message: 31/10/2007, 12h03
  5. degriser une case de formulaire a l'appui sur un lien
    Par Jim_Nastiq dans le forum Général JavaScript
    Réponses: 2
    Dernier message: 02/05/2006, 11h12

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo