cs_Maxime31
Messages postés79Date d'inscriptionsamedi 4 février 2006StatutMembreDernière intervention28 juillet 2008
-
28 juil. 2008 à 19:31
cs_Simon972
Messages postés1Date d'inscriptionvendredi 26 août 2011StatutMembreDernière intervention23 septembre 2011
-
23 sept. 2011 à 11:29
Voici le code d'un programme tout simple...
Des bouttons + et - qui font varier le contenu de labels grace a des variables decimales...
Ca donne ca
Public Class Form1
Inherits System.Windows.Forms.Form
Friend WithEvents poids As System.Windows.Forms.Label
Friend WithEvents poidsplus As System.Windows.Forms.Button
Friend WithEvents poidsmoins As System.Windows.Forms.Button
Friend WithEvents dilumoins As System.Windows.Forms.Button
Friend WithEvents diluplus As System.Windows.Forms.Button
Friend WithEvents dilu As System.Windows.Forms.Label
Friend WithEvents RadioButton1 As System.Windows.Forms.RadioButton
Friend WithEvents RadioButton2 As System.Windows.Forms.RadioButton
Friend WithEvents RadioButton3 As System.Windows.Forms.RadioButton
Friend WithEvents posoplus As System.Windows.Forms.Button
Friend WithEvents posomoins As System.Windows.Forms.Button
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents poso As System.Windows.Forms.Label
Friend WithEvents MainMenu1 As System.Windows.Forms.MainMenu
#Region " Code généré par le Concepteur Windows Form "
Public Sub New()
MyBase.New()
'Cet appel est requis par le Concepteur Windows Form.
InitializeComponent()
'Ajoutez une initialisation quelconque après l'appel InitializeComponent()
End Sub
'Form remplace la méthode Dispose pour nettoyer la liste des composants.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
MyBase.Dispose(disposing)
End Sub
'REMARQUE : la procédure suivante est requise par le Concepteur Windows Form
'Elle peut être modifiée à l'aide du Concepteur Windows Form.
'Ne la modifiez pas à l'aide de l'éditeur de code.
Private Sub InitializeComponent()
Me.MainMenu1 = New System.Windows.Forms.MainMenu
Me.poids = New System.Windows.Forms.Label
Me.poidsplus = New System.Windows.Forms.Button
Me.poidsmoins = New System.Windows.Forms.Button
Me.dilumoins = New System.Windows.Forms.Button
Me.diluplus = New System.Windows.Forms.Button
Me.dilu = New System.Windows.Forms.Label
Me.RadioButton1 = New System.Windows.Forms.RadioButton
Me.RadioButton2 = New System.Windows.Forms.RadioButton
Me.RadioButton3 = New System.Windows.Forms.RadioButton
Me.posoplus = New System.Windows.Forms.Button
Me.posomoins = New System.Windows.Forms.Button
Me.Label1 = New System.Windows.Forms.Label
Me.Label2 = New System.Windows.Forms.Label
Me.poso = New System.Windows.Forms.Label
'
'poids
'
Me.poids.Location = New System.Drawing.Point(122, 32)
Me.poids.Size = New System.Drawing.Size(26, 20)
Me.poids.Text = "50"
Me.poids.TextAlign = System.Drawing.ContentAlignment.TopCenter
'
'poidsplus
'
Me.poidsplus.Location = New System.Drawing.Point(45, 32)
Me.poidsplus.Size = New System.Drawing.Size(28, 20)
Me.poidsplus.Text = "+"
'
'poidsmoins
'
Me.poidsmoins.Location = New System.Drawing.Point(79, 32)
Me.poidsmoins.Size = New System.Drawing.Size(28, 20)
Me.poidsmoins.Text = "-"
'
'dilumoins
'
Me.dilumoins.Location = New System.Drawing.Point(79, 95)
Me.dilumoins.Size = New System.Drawing.Size(28, 20)
Me.dilumoins.Text = "-"
'
'diluplus
'
Me.diluplus.Location = New System.Drawing.Point(45, 95)
Me.diluplus.Size = New System.Drawing.Size(28, 20)
Me.diluplus.Text = "+"
'
'dilu
'
Me.dilu.Location = New System.Drawing.Point(122, 95)
Me.dilu.Size = New System.Drawing.Size(26, 20)
Me.dilu.Text = "1"
Me.dilu.TextAlign = System.Drawing.ContentAlignment.TopCenter
'
'RadioButton1
'
Me.RadioButton1.Location = New System.Drawing.Point(117, 158)
Me.RadioButton1.Size = New System.Drawing.Size(100, 20)
Me.RadioButton1.Text = "µg/Kg/h"
'
'RadioButton2
'
Me.RadioButton2.Location = New System.Drawing.Point(117, 184)
Me.RadioButton2.Size = New System.Drawing.Size(100, 20)
Me.RadioButton2.Text = "mg/Kg/h"
'
'RadioButton3
'
Me.RadioButton3.Location = New System.Drawing.Point(117, 210)
Me.RadioButton3.Size = New System.Drawing.Size(100, 20)
Me.RadioButton3.Text = "mg/h"
'
'posoplus
'
Me.posoplus.Location = New System.Drawing.Point(35, 167)
Me.posoplus.Size = New System.Drawing.Size(27, 20)
Me.posoplus.Text = "+"
'
'posomoins
'
Me.posomoins.Location = New System.Drawing.Point(35, 193)
Me.posomoins.Size = New System.Drawing.Size(27, 20)
Me.posomoins.Text = "-"
'
'Label1
'
Me.Label1.Location = New System.Drawing.Point(154, 32)
Me.Label1.Size = New System.Drawing.Size(28, 20)
Me.Label1.Text = "Kg"
'
'Label2
'
Me.Label2.Location = New System.Drawing.Point(154, 95)
Me.Label2.Size = New System.Drawing.Size(46, 20)
Me.Label2.Text = "mg/ml"
'
'poso
'
Me.poso.Location = New System.Drawing.Point(79, 184)
Me.poso.Size = New System.Drawing.Size(26, 20)
Me.poso.Text = "1"
'
'Form1
'
Me.ClientSize = New System.Drawing.Size(240, 294)
Me.Controls.Add(Me.poso)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.posomoins)
Me.Controls.Add(Me.posoplus)
Me.Controls.Add(Me.RadioButton3)
Me.Controls.Add(Me.RadioButton2)
Me.Controls.Add(Me.RadioButton1)
Me.Controls.Add(Me.dilumoins)
Me.Controls.Add(Me.diluplus)
Me.Controls.Add(Me.dilu)
Me.Controls.Add(Me.poidsmoins)
Me.Controls.Add(Me.poidsplus)
Me.Controls.Add(Me.poids)
Me.Text = "Form1"
End Sub
#End Region
Public varpoids, vardilu, varposo As Decimal
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
varpoids = 50
vardilu = 1
varposo = 1
poids.Text = varpoids.ToString
dilu.Text = vardilu.ToString
End Sub
Private Sub poidsplus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles poidsplus.Click
varpoids = (varpoids + 0.5)
poids.Text = varpoids.ToString
End Sub
Private Sub poidsmoins_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles poidsmoins.Click
varpoids = (varpoids - 0.5)
poids.Text = varpoids.ToString
End Sub
Private Sub diluplus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles diluplus.Click
vardilu = (vardilu + 0.5)
dilu.Text = vardilu.ToString
End Sub
Private Sub dilumoins_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles dilumoins.Click
vardilu = (vardilu - 0.5)
dilu.Text = vardilu.ToString
End Sub
Private Sub posoplus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles posoplus.Click
varposo = (varposo + 0.5)
poso.Text = varposo.ToString
End Sub
Private Sub posomoins_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles posomoins.Click
varposo = (varposo - 0.5)
poso.Text = varposo.ToString
End Sub
End Class
Et là :
Avertissement 1 Défaillance irrémédiable (Exception de HRESULT : 0x8000FFFF (E_UNEXPECTED)) 0 0
Je comprend pas... erreur de l'affichage en "design" de ma form... Pourtant, y'a rien de bien méchant, non ?
cs_Simon972
Messages postés1Date d'inscriptionvendredi 26 août 2011StatutMembreDernière intervention23 septembre 20111 23 sept. 2011 à 11:29
Je développe en C++/CLI, et j'ai eu le même problème sous Visual 2008.
Impossible d'afficher le concepteur de vue sur une form alors que la compilation et le link sont ok.
Il faut faire un nettoyage complet de la solution dans l'explorateur Windows :
- Supprimer les dossiers : bin et obs
- Supprimer les 2 fichiers : *.ncb et *.suo
Ré-ouvrir la solution et re-compiler. Sa re-marche ensuite.