begin process at 2012 02 16 14:26:11
  Trouver un code source :
 
dans
 
Accueil > Forum > 

VB.NET et VB 2005

 > 

Windows

 > 

Autre

 > 

Probleme pour Expet vb.net 2005


Derniers messages déposésPoser une question dans le forum ou lancer une discussion

Probleme pour Expet vb.net 2005

jeudi 21 décembre 2006 à 16:24:58 | Probleme pour Expet vb.net 2005

XGuarden

Bonjour, mon probleme est très complexe et je doute avoir de réponse honetement lol. J'essait tout de meme.

J'ai une classe qui hérite du controle textbox et qui me permet de valider les données d'apres une cellule Excel. J'ai égallement une classe semblable pour plusieur controle voice le code:

Imports Microsoft.Office.Interop.excel

Public Class TextBoxValidator
    Inherits System.Windows.Forms.TextBox

    Private cellValidation As Range
    Private validatestate As Boolean = False
    Private tooltip As New ToolTip

    Public ReadOnly Property getState() As Boolean
        Get
            Return validatestate
        End Get
    End Property

    Public Property ValidationCell() As Range
        Get
            Return cellValidation
        End Get
        Set(ByVal cell As Range)
            cellValidation = cell
        End Set
    End Property

    Private Sub TextBoxValidator_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.GotFocus
        If Me.ForeColor = Color.Gray Then
            Me.Clear()
            Me.ForeColor = Color.Black
        End If
    End Sub

    Private Sub Text_Validating(ByVal sender As Object, _
    ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Validating

        cellValidation.Value = CType(sender, Control).Text

        Try

            If cellValidation.Validation.Value Then
                validatestate = True
                Me.BackColor = Color.White
            Else
                validatestate = False
                Me.BackColor = Color.Red
                tooltip.IsBalloon = True
                tooltip.ToolTipIcon = CType(cellValidation.Validation.AlertStyle, ToolTipIcon)
                tooltip.ToolTipTitle = cellValidation.Validation.ErrorTitle
                tooltip.Show(cellValidation.Validation.ErrorMessage, Me, 2000)
            End If

        Catch Er As Exception

            If Err.Number = 1004 Then
                Err.Clear()
            Else
                MsgBox(Er.Message)
            End If

        End Try

    End Sub

    Public Sub New(ByVal text As String)
        Me.ForeColor = Color.Gray
        Me.Text = text
    End Sub

End Class

Public Class NumericTextBoxValidator
    Inherits System.Windows.Forms.TextBox

    Private cellValidation As Range
    Private validatestate As Boolean = False
    Private tooltip As New ToolTip

    Public ReadOnly Property getState() As Boolean
        Get
            Return validatestate
        End Get
    End Property

    Public Property ValidationCell() As Range
        Get
            Return cellValidation
        End Get
        Set(ByVal Value As Range)
            cellValidation = Value
        End Set
    End Property

    Private Sub NumericTextBoxValidator_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.GotFocus
        If Me.ForeColor = Color.Gray Then
            Me.Clear()
            Me.ForeColor = Color.Black
        End If
    End Sub

    Private Sub NumericTextBoxValidator_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Me.KeyPress
        If AscW(e.KeyChar) = 8 Then Exit Sub
        If Not IsNumeric(e.KeyChar) Or e.KeyChar = "," Then
            e.KeyChar = Nothing
        End If
    End Sub

    Private Sub Text_Validating(ByVal sender As Object, _
    ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Validating

        cellValidation.Value = CType(sender, Control).Text

        Try

            If cellValidation.Validation.Value Then
                validatestate = True
                Me.BackColor = Color.White
            Else
                validatestate = False
                Me.BackColor = Color.Red
                ToolTip.IsBalloon = True
                ToolTip.ToolTipIcon = CType(cellValidation.Validation.AlertStyle, ToolTipIcon)
                ToolTip.ToolTipTitle = cellValidation.Validation.ErrorTitle
                ToolTip.Show(cellValidation.Validation.ErrorMessage, Me, 2000)
            End If

        Catch Er As Exception

            If Err.Number = 1004 Then
                Err.Clear()
            Else
                MsgBox(Er.Message)
            End If

        End Try


    End Sub

    Public Sub New(ByVal text As String)
        Me.ForeColor = Color.Gray
        Me.Text = text
    End Sub

End Class

Public Class ComboBoxValidator
    Inherits System.Windows.Forms.ComboBox

    Private cellValidation As Range
    Private validatestate As Boolean = False
    Private tooltip As New ToolTip

    Public ReadOnly Property getState() As Boolean
        Get
            Return validatestate
        End Get
    End Property

    Public Property ValidationCell() As Range
        Get
            Return cellValidation
        End Get
        Set(ByVal Value As Range)
            cellValidation = Value
        End Set
    End Property

    Private Sub ComboBoxValidator_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.GotFocus
        If Me.ForeColor = Color.Gray Then
            Me.ForeColor = Color.Black
        End If
    End Sub

    Private Sub Text_Validating(ByVal sender As Object, _
ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Validating

        cellValidation.Value = CType(sender, Control).Text

        Try

            If cellValidation.Validation.Value Then
                validatestate = True
                Me.BackColor = Color.White
            Else
                validatestate = False
                Me.BackColor = Color.Red
                ToolTip.IsBalloon = True
                ToolTip.ToolTipIcon = CType(cellValidation.Validation.AlertStyle, ToolTipIcon)
                ToolTip.ToolTipTitle = cellValidation.Validation.ErrorTitle
                ToolTip.Show(cellValidation.Validation.ErrorMessage, Me, 2000)
            End If

        Catch Er As Exception

            If Err.Number = 1004 Then
                Err.Clear()
            Else
                MsgBox(Er.Message)
            End If

        End Try

    End Sub

    Public Sub New(ByVal text As String)
        Me.ForeColor = Color.Gray
        Me.Text = text
    End Sub

End Class

Public Class DateTimePickerValidator
    Inherits System.Windows.Forms.DateTimePicker

    Private cellValidation As Range
    Private validatestate As Boolean = False
    Private tooltip As New ToolTip

    Public ReadOnly Property getState() As Boolean
        Get
            Return validatestate
        End Get
    End Property

    Public Property ValidationCell() As Range
        Get
            Return cellValidation
        End Get
        Set(ByVal Value As Range)
            cellValidation = Value
        End Set
    End Property

    Private Sub DateTimePickerValidator_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.GotFocus
        If Me.ForeColor = Color.Gray Then
            Me.ForeColor = Color.Black
        End If
    End Sub

    Private Sub Text_Validating(ByVal sender As Object, _
ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Validating

        cellValidation.Value = CType(sender, Control).Text

        Try

            If cellValidation.Validation.Value Then
                validatestate = True
                Me.BackColor = Color.White
            Else
                validatestate = False
                Me.BackColor = Color.Red
                ToolTip.IsBalloon = True
                ToolTip.ToolTipIcon = CType(cellValidation.Validation.AlertStyle, ToolTipIcon)
                ToolTip.ToolTipTitle = cellValidation.Validation.ErrorTitle
                ToolTip.Show(cellValidation.Validation.ErrorMessage, Me, 2000)
            End If

        Catch Er As Exception

            If Err.Number = 1004 Then
                Err.Clear()
            Else
                MsgBox(Er.Message)
            End If

        End Try

    End Sub

    Public Sub New(ByVal text As String)
        Me.ForeColor = Color.Gray
        Me.Text = text
    End Sub

End Class

Public Class NumericUpDownValidator
    Inherits System.Windows.Forms.NumericUpDown

    Private cellValidation As Range
    Private validatestate As Boolean = False
    Private tooltip As New ToolTip

    Public ReadOnly Property getState() As Boolean
        Get
            Return validatestate
        End Get
    End Property

    Public Property ValidationCell() As Range
        Get
            Return cellValidation
        End Get
        Set(ByVal Value As Range)
            cellValidation = Value
        End Set
    End Property

    Private Sub NumericUpDownValidator_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.GotFocus
        If Me.ForeColor = Color.Gray Then
            Me.ForeColor = Color.Black
        End If
    End Sub

    Private Sub Text_Validating(ByVal sender As Object, _
ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Validating

        cellValidation.Value = CType(sender, Control).Text

        Try

            If cellValidation.Validation.Value Then
                validatestate = True
                Me.BackColor = Color.White
            Else
                validatestate = False
                Me.BackColor = Color.Red
                ToolTip.IsBalloon = True
                ToolTip.ToolTipIcon = CType(cellValidation.Validation.AlertStyle, ToolTipIcon)
                ToolTip.ToolTipTitle = cellValidation.Validation.ErrorTitle
                ToolTip.Show(cellValidation.Validation.ErrorMessage, Me, 2000)
            End If

        Catch Er As Exception

            If Err.Number = 1004 Then
                Err.Clear()
            Else
                MsgBox(Er.Message)
            End If

        End Try

    End Sub

    Public Sub New(ByVal text As String)
        Me.ForeColor = Color.Gray
        Me.Text = text
    End Sub

End Class


!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Ce code fonctionne pas trop mal en général. quelque erreur que je ne comprend pas arrive parois mais bon. Voici un autre code, ces celui d'une forme Excel qui me donne des mots de tete depuis une semaine.


Imports Microsoft.Office.Interop
Imports Microsoft.Office.Interop.excel.XlDVType

Public Class frmFormulaire

    Private ExcelObj As New Excel.Application()
    Private theWorkbook As Excel.Workbook
    Private worksheet As New Excel.Worksheet
    Private parametre() As String
    Private modExcel As New modExcel
    Private action As String

    Private Function GetLabel(ByVal texte As String) As Label
        Static index As Integer = 0
        Dim x As New Label
        x.AutoSize = True
        x.Location = New System.Drawing.Point(0, 0)
        x.Name = "lblinfo" & index.ToString
        x.Size = New System.Drawing.Size(80, 20)
        x.Text = texte
        x.Dock = DockStyle.Fill
        index = index + 1
        Return x
    End Function

    Private Function GetControl(ByVal cell As Excel.Range) As Control
        Static index As Integer = 0
        Dim mycontrol As New Control

        Try
            Select Case cell.Validation.Type

                Case xlValidateWholeNumber
                    Dim number As New NumericUpDownValidator(cell.Value.ToString)
                    number.Maximum = Integer.MaxValue
                    number.ValidationCell = cell
                    mycontrol = number

                Case xlValidateDecimal
                    Dim number As New NumericTextBoxValidator(cell.Value.ToString)
                    number.ValidationCell = cell
                    mycontrol = number

                Case xlValidateList
                    Dim text As New ComboBoxValidator(cell.Value.ToString)
                    text.Items.AddRange(cell.Validation.Formula1.Split(";".ToCharArray))
                    text.Text = text.Items(0).ToString
                    text.ValidationCell = cell
                    mycontrol = text

                Case xlValidateDate
                    Dim time As New DateTimePickerValidator(cell.Value.ToString)
                    time.ValidationCell = cell
                    mycontrol = time

                Case Else
                    Dim text As New TextBoxValidator(cell.Value.ToString)
                    text.ValidationCell = cell
                    mycontrol = text

            End Select

        Catch Er As Exception

            If Err.Number = 1004 Then
                Dim text As New TextBoxValidator(cell.Value.ToString)
                text.ValidationCell = cell
                mycontrol = text
                Err.Clear()
            Else
                MsgBox(Er.InnerException)
            End If

        End Try

        mycontrol.AutoSize = True
        mycontrol.Location = New System.Drawing.Point(0, 0)
        mycontrol.Name = "lblinfo" & index.ToString
        mycontrol.Size = New System.Drawing.Size(80, 20)
        mycontrol.Dock = DockStyle.Fill
        index = index + 1

        Return mycontrol

    End Function



    Private Function GetValidRange(ByVal validation As Excel.Validation, ByVal myrange As Excel.Range) As Boolean
        Return validation.Value
    End Function

    Private Sub vScrollBar1_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles vScrollBar1.Scroll
        tableLayoutPanel1.Top = vScrollBar1.Value * -28
    End Sub

    Private Sub frmFormulaire_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim derniereligne As Integer = modExcel.DerniereLigne(worksheet) - 1
        ChargerTableau()
        nudNumericUpDown1.Maximum = derniereligne
    End Sub

    Private Sub frmFormulaire_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
        expGestionTableau.Height = Me.Height
    End Sub

    Public Sub New(ByVal BDpath As String, ByVal sheet As String, ByVal myparametre As String)

        ' This call is required by the Windows Form Designer.
        InitializeComponent()


        ' Add any initialization after the InitializeComponent() call.

        Dim MyFile As New System.IO.FileInfo(Application.StartupPath & "\" & BDpath)
        If MyFile.Exists() Then
            Try
                theWorkbook = ExcelObj.Workbooks.Open(Application.StartupPath & "\" & BDpath, 0, False, 5, "", "", True, Excel.XlPlatform.xlWindows, Constants.vbTab, True, True, 0, True, True, False)
                worksheet = CType(theWorkbook.Worksheets.Item(sheet), Excel.Worksheet)

                parametre = myparametre.Split("}".ToCharArray)
                parametre(1).Trim()

                Me.Text = parametre(0) & "}"
            Catch Er As Exception
                Throw New Exception("Imposible d'ouvrir le projet Excel. " & Er.Message)
            End Try

        Else
            Throw New System.IO.FileNotFoundException
        End If

    End Sub

    '!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!
    '!=!=!=!=!               Procédures de chargements               !=!=!=!=!
    '!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!

#Region "Procédures et fonctions de chargement"

    Private Sub ClickExplorerItemBar(ByVal sender As Object, _
                                      ByVal args As ExplorerBarClickEventArgs) _
             Handles expGestionTableau.BarClick

        Try

            'Récupération de la bar d'exploration sélectionner
            If CBool(args.Bar.State) Then

                tableLayoutPanel1.Visible = True

                Select Case args.Bar.Text

                    Case "Ajout d'information"
                        tableLayoutPanel1.Enabled = True
                        ModificationExplorerBarAjouter()

                    Case "Modifier une information"
                        tableLayoutPanel1.Enabled = True
                        ModificationExplorerBarModifier()

                    Case "Supprimer une information"
                        tableLayoutPanel1.Enabled = False
                        ModificationExplorerBarSupprimer()

                End Select
            Else
                action = Nothing
                tableLayoutPanel1.Visible = False
                nudNumericUpDown1.Visible = False


                PicHaut.Image = Image.FromFile(Application.StartupPath & "\Images\ImageHautBleu.bmp")
                PicDroite.Image = Image.FromFile(Application.StartupPath & "\Images\ImageDroiteBleu.bmp")
            End If

            If tableLayoutPanel1.RowCount < 10 Then
                vScrollBar1.Maximum = 0
            Else
                vScrollBar1.Maximum = tableLayoutPanel1.RowCount - 9
            End If

        Catch er As Exception
            MsgBox(er.Message)
        End Try

    End Sub

    Private Sub ChargementExplorerBar(ByVal sender As System.Object, _
                                  ByVal e As System.EventArgs) _
        Handles expGestionTableau.Load

        Try
            With expGestionTableau
                .Bars.Add(ChargementAjouter)
                .Bars.Add(ChargementModifier)
                .Bars.Add(ChargementSupprimer)

                .Bars(0).State = 0
                .Bars(1).State = 0
                .Bars(2).State = 0
            End With

            Exit Sub

        Catch er As Exception
            MsgBox(er.Message)
        End Try

    End Sub

    Private Function ChargementAjouter() As ExplorerBar

        'Déclaration de la barre d'Exploration Ajouter
        '!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!

        Dim RAjouter As New ExplorerBar
        RAjouter.Text = "Ajout d'information"
        RAjouter.ToolTipText = "Ajouter"
        RAjouter.IconIndex = 0

        Dim RAjoutMembre As New ExplorerBarTextItem
        RAjoutMembre.Text = "Ajoût d'informtion au tableau"

        '!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!
        RAjouter.Items.Add(RAjoutMembre)

        Return RAjouter
    End Function

    Private Function ChargementModifier() As ExplorerBar

        'Déclaration de la barre d'Exploration Ajouter
        '!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!

        Dim RModifier As New ExplorerBar
        RModifier.Text = "Modifier une information"
        RModifier.ToolTipText = "Modifier"
        RModifier.IconIndex = 1

        Dim RModifierMembre As New ExplorerBarTextItem
        RModifierMembre.Text = "Modification des informations du tableau"

        '!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!
        RModifier.Items.Add(RModifierMembre)

        Return RModifier
    End Function

    Private Function ChargementSupprimer() As ExplorerBar

        'Déclaration de la barre d'Exploration Ajouter
        '!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!

        Dim RSupprimer As New ExplorerBar
        RSupprimer.Text = "Supprimer une information"
        RSupprimer.ToolTipText = "Supprimer"
        RSupprimer.IconIndex = 2

        Dim RSupprimerMembre As New ExplorerBarTextItem
        RSupprimerMembre.Text = "Supprimer une information"

        '!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!
        RSupprimer.Items.Add(RSupprimerMembre)

        Return RSupprimer
    End Function

#End Region

    '!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!
    '!=!=!=!=!  Procédures de modification de la bar d'exploration   !=!=!=!=!
    '!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!

#Region "Procédures de modification de la bar d'exploration"

    Private Sub ModificationExplorerBarAjouter()

        action = "Ajouter"
        nudNumericUpDown1.Visible = False

        expGestionTableau.Bars(1).State = ExplorerBarState.Collapsed
        expGestionTableau.Bars(2).State = ExplorerBarState.Collapsed

        PicHaut.Image = Image.FromFile(Application.StartupPath & "\Images\ImageHautAjouter.bmp")
        PicDroite.Image = Image.FromFile(Application.StartupPath & "\Images\ImageDroiteBleu.bmp")

    End Sub

    Private Sub ModificationExplorerBarModifier()

        nudNumericUpDown1.Visible = True

        expGestionTableau.Bars(0).State = ExplorerBarState.Collapsed
        expGestionTableau.Bars(2).State = ExplorerBarState.Collapsed

        PicHaut.Image = Image.FromFile(Application.StartupPath & "\Images\ImageHautModifier.bmp")
        PicDroite.Image = Image.FromFile(Application.StartupPath & "\Images\ImageDroiteVert.bmp")

        If Action = Nothing Or Action = "Ajouter" Then
            Action = "Modifier"
            nudNumericUpDown1.Value = modExcel.DerniereLigne(worksheet) - 1
        Else
            ChargerInfo(modExcel.DerniereLigne(worksheet))
        End If

    End Sub

    Private Sub ModificationExplorerBarSupprimer()

        nudNumericUpDown1.Visible = True

        expGestionTableau.Bars(0).State = ExplorerBarState.Collapsed
        expGestionTableau.Bars(1).State = ExplorerBarState.Collapsed

        PicHaut.Image = Image.FromFile(Application.StartupPath & "\Images\ImageHautSupprimer.bmp")
        PicDroite.Image = Image.FromFile(Application.StartupPath & "\Images\ImageDroiteRouge.bmp")

        If Action = Nothing Or Action = "Ajouter" Then
            Action = "Supprimer"
            nudNumericUpDown1.Value = modExcel.DerniereLigne(worksheet) - 1
        Else
            ChargerInfo(modExcel.DerniereLigne(worksheet))
        End If

    End Sub

#End Region


    Private Sub splitContainer1_SizeChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles splitContainer1.SizeChanged
        tableLayoutPanel1.Width = splitContainer1.Width - 20
    End Sub

    Private Sub ChargerTableau()
        Dim myparametre() As String = parametre(1).Trim.Split(" ;".ToCharArray)

        Dim range As Excel.Range = worksheet.Range(myparametre(0) & CInt(myparametre(1)) + 1, myparametre(2) & CInt(myparametre(1)) + 1)
        Dim theArray As String() = modExcel.ConvertToStringArray(CType(range.Cells.Value, System.Array))

        For Each title As String In theArray

            With tableLayoutPanel1

                .Height = tableLayoutPanel1.Height + 28
                .Controls.Add(GetLabel(title))
                'Dim cell As String = modExcel.GetLetterFromNumber(System.Array.IndexOf(theArray, title) + 1) & CInt(myparametre(1)) + 1
                Dim cell As String = modExcel.GetLetterFromNumber(System.Array.IndexOf(theArray, title) + 1) & modExcel.DerniereLigne(worksheet)

                .Controls.Add(GetControl(worksheet.Range(cell)))
                .RowCount = tableLayoutPanel1.RowCount + 1

            End With

        Next title

    End Sub

    Private Sub nudNumericUpDown1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nudNumericUpDown1.ValueChanged
        If Not action = Nothing Then
            ChargerInfo(CInt(nudNumericUpDown1.Value) + 1)
        End If
    End Sub

    Private Sub ChargerInfo(ByVal index As Integer)
        Dim myparametre() As String = parametre(1).Trim.Split(" ;".ToCharArray)
        aaa(worksheet.Range(myparametre(0) & index, myparametre(2) & index))


    End Sub
    Private Sub aaa(ByVal range As Excel.Range)
        Dim theArray As String() = modExcel.ConvertToStringArray(CType(range.Cells.Value, System.Array))
        For i As Integer = 0 To theArray.Length - 1

            With tableLayoutPanel1
                .Controls.Item(i * 2 + 1).ForeColor = Color.Black
                .Controls.Item(i * 2 + 1).Text = theArray(i)
            End With

        Next i
    End Sub
    Private Sub cmdApliquer_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdApliquer.Click

        Dim myparametre() As String = parametre(1).Trim.Split(" ;".ToCharArray)

        Try

            cmdApliquer.Enabled = False

            Select Case action

                Case "Ajouter"


                Case "Modifier"

                    Dim noLigne As Integer = CInt(nudNumericUpDown1.Value)
                    Dim strRange(CInt(tableLayoutPanel1.Controls.Count / 2)) As String

                    For Each control As Control In tableLayoutPanel1.Controls
                        If Not control.GetType.Name = "Label" Then
                            strRange(CInt(control.TabIndex / 2 - 0.5)) = control.Text
                        End If
                    Next

                    Dim range As Excel.Range = worksheet.Range(myparametre(0) & noLigne, myparametre(2) & noLigne)
                    range.Value = strRange

                Case "Supprimer"

                    Dim noLigne As Integer = CInt(nudNumericUpDown1.Value)

                    If MsgBox("Voulez-vous supprimer le reste de la ligne égallement?", MsgBoxStyle.YesNo, "Confirmer") = MsgBoxResult.Yes Then
                        worksheet.Rows.Delete(nudNumericUpDown1.Value)
                    Else
                        worksheet.Range(myparametre(0) & noLigne, myparametre(2) & noLigne).Clear()
                    End If

                Case Nothing
                    Throw New Exception("Vous devez d'habord sélectionner une oppération")

            End Select

            theWorkbook.Save()

        Catch Er As Exception
            MsgBox(Er.Message)
        Finally
            cmdApliquer.Enabled = True
        End Try

    End Sub


    Private Sub Annuler_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Annuler.Click

    End Sub

End Class

En passant si vous vouler la source, donne moi juste votre email.

Voici ce qui arrive.... Je signal que cettte forme n'Est pas terminé ce qui explique beaucoup de truc ridicule... Lorsce que je modifie le texte dans une textbox, cela le modifie immédiatement dans le fichier Excel. Je ne comprend pas pourquoi la modification se fait toute seul. On dirait que mes control son associé à des cellule Excel. Autre probleme, ces que sa ajouter deux enregistrement a chaque fois quand je fait modifier une à la bonne endroit et l'autre en ajout. Ce qui viendrai confirmer que mes textbox son ssocié a des cellules. Autre truc tanant mais que ces secondaire, ces la fameuse instance en ram d'excel qui veut rien savoir. Entuka je voudrai qu'on m'Explique comment sa se fait que mes textbox soit associé automatiquement a des cellules. Merci. Finalement le pire probleme, celui qui pourais mettre lAvenir de l'humanité en jeu!!! J'ai pas du lait pour me faire un chocolat chaud


Cette discussion est classée dans : text, end, system, private, cellvalidation


Répondre à ce message

Sujets en rapport avec ce message

Comment Réaliser un DragandDrop avec des panel contenant des picturebox [ par Nabil461 ] pouvez vous m'aider a réalsier un draganddrop avec des pannel contennant, des picturebox, je ne sais pas si je doit draguez les 11 pannel ou bien leur drag and drop de plusieurs labels [ par bahharkarim ] bonjour a tout le monde j'ai créer une application ou il y a 6 labels et j'utilise la fonction drag and drop le problème c'est que lors le contenu d utilisation de la fonction drag and drop [ par bahharkarim ] bonjour j'utilise 4 label 1;2;4;5 dans vb 2008[^^sad1] et je le drag and drop de label1 vers label3 et label2 vers label5 mais il ne fonctionne pas c Enregistrer valeurs compteur [ par vivacity45 ] Bonjour, je fait actuellement un compteur ( lorsque l'on clique sur "+" sa ajoute 1 au label et sur "-" sa retir 1) mais j'ai un probleme :s Je voudra Recherche par critére [ par napsterachem ] salut, j'ai créé un form avec un textbox et un datagridview et 3 radio boutton voilà un petit aperçu [img]http://www.imagup.com/pics/1280288324.html[ enregistrement datagrid [ par ocejade ] bonjour a tous je me pose comme question comment enregistrer un datagridview en vb.net 2008 express en sachant que je ne veut pas utiliser acces .je retour chariot enVB6 [ par sirin01 ] slt à tous s.v.p j ai un tp à faire ,j ai créer un fenetre PeerA Private Sub Envoyer_Click() udpPeerA.SendData Send.Text End Sub Private Sub For Affichage de données de prod VB 2008 Express [ par puipuich ] Bonjour à tous !!! Je post pour la première fois ici car (là) je suis bloqué avec un problème à la con. Pour faire court (je donnerais des détails s Property d'un UserControl "System.Text.Encoding" modifiable par le concepteur de vue [ par Polack77 ] Bonjour, Je code en ce moment un UserControl me permettant de configurer une classe (à fin de l'insérer ensuite dans mes écrans de configuration de d Soucis de "count" avec Active Directory [ par novice69 ] Bonjour, je cherche le nombres d'utilisateurs dans un groupe AD. Mon soucis, lorsque que les groupes contiennent plus d'environ 1000 users ( estimati


Nos sponsors


Sondage...

Comparez les prix

CalendriCode

Février 2012
LMMJVSD
  12345
6789101112
13141516171819
20212223242526
272829    

Consulter la suite du CalendriCode

 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 1,076 sec (4)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales