Duplication de label avec VisualBasic

Résolu
sanndr Messages postés 37 Date d'inscription jeudi 21 octobre 2004 Statut Membre Dernière intervention 13 novembre 2010 - 7 nov. 2004 à 20:20
sanndr Messages postés 37 Date d'inscription jeudi 21 octobre 2004 Statut Membre Dernière intervention 13 novembre 2010 - 11 nov. 2004 à 12:47
Bonjour a tous!

J'aimerai créer un groupe de label sur une form en recuperant la valeur de retour saisie dans uine inputbox

nesnes
A voir également:

4 réponses

jesusonline Messages postés 6814 Date d'inscription dimanche 15 décembre 2002 Statut Membre Dernière intervention 13 octobre 2010 29
7 nov. 2004 à 21:00
Pas tout à fait sur d'avoir saisi ce que tu voulais, mais un truc comme ca te satisferait il ?

<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<script runat="server">
    
    Sub TextBox1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs)
        
        Dim lbl As Label
        For i As Integer = 1 To 10
            lbl = New Label()
            lbl.ID = "Label" & i.ToString
            lbl.Text = TextBox1.Text
            PlaceHolder1.Controls.Add(New LiteralControl("
"))
            PlaceHolder1.Controls.Add(lbl)
            
        Next
        
    End Sub
    
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>

    <form id="form1" runat="server">
        

                
            
        

    </form>

</html>


Cyril
3
sanndr Messages postés 37 Date d'inscription jeudi 21 octobre 2004 Statut Membre Dernière intervention 13 novembre 2010
8 nov. 2004 à 18:00
Merci Cyril
Il faut juste que je l'adapte à visual basic
nesnes
0
jesusonline Messages postés 6814 Date d'inscription dimanche 15 décembre 2002 Statut Membre Dernière intervention 13 octobre 2010 29
8 nov. 2004 à 22:03
euh ....
c'est du VB :big)

Par contre c'est du .net, et je suis pas sur que tu puisses faire ca en asp simple ...

Cyril
0
sanndr Messages postés 37 Date d'inscription jeudi 21 octobre 2004 Statut Membre Dernière intervention 13 novembre 2010
11 nov. 2004 à 12:47
salut Cyril

Voici la solution pour les personnes qui pratique VB.

Private Sub cmdcalcul_Click()
Dim value As String
Dim i As Integer
Dim nombre As Integer
Dim vnom As String
Dim lblctl As Label

value = InputBox("nombre de d'emplacements", "Saisissez le nombre d'emplacements")

Do Until i = value
i = i + 1
nombre = i

If value <> 0 Then
'creation d'un nouveau label
vnom = "lblLabel" & i
Set lblctl = Me.Controls.Add("vb.label", vnom)
With lblctl
.Alignment = vbCenter
.Caption = i
.Font = "system"
.Height = 255
.Left = 300
.BorderStyle = 1
.Width = 255
End With
If value < 1 Then
With lblctl
.Top = 450
.Visible = True
End With
Else
With lblctl
.Top = 450 + i * (.Height + 10)
.Visible = True
End With

End If

Else
With lblctl
End With
End If
Loop
End Sub

nesnes
0
Rejoignez-nous