Vous ne trouvez pas de réponse à votre problème ? Alors posez la question dans le forum. Souvenez-vous qu'il n'y a jamais de question bête, mais rester dans l'ignorance parce que l'on n'ose pas poser une question, ça c'est une erreur !

Sujet : Probleme pour Expet vb.net 2005 [ Windows / Autre ] (XGuarden)

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é 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 Probleme imcompréensible [ par XGuarden ] Voici 3 semaine que j'ai le meme probleme...Pour vous expliquer le probleme, je vais le montrer en 3 étapes. Premierement voici une classe de mon prog Controle de la lecture d'un fichier Flash [ par vbkriss ] Bonjour,Dans une application contenant seulement Form1, j'ai placé un composant ShockWave Flash Object, un Label, 3 TextBox, 1 LinkLabel, 1 timer et 1 Modification d'un TextBox à partir d'un autre thread [ par shackleton1986 ] Le but de ce message est de savoir s'il existe une manière plus simple de réaliser ce code en VB .Net.Voici le but très simple de ce programme :Il s'a SerialPort [ par lucgabon ] je viens de débuter en VB, je cherche simplement pour l'instant d'afficher les bytes qui vienent sur le port com3 dans n RichTextBoxj'envoie sur le po Timer tick besoin d'aide !! [ par vaucer ] Bonjour, J'ai un problème au sujet d`un petit programme d`alarme qui se dèclenche grace à la fonction timer TickJe ne connais pas bien le visual Basic Erreur de systax [ par DanMor498 ] Imports System.Data Imports system.Data.OleDb Imports</fo Serial Port problème... [ par Vador7789 ] Bonjour à tous!!Je suis débutant en programmation vb.net et je possède Visual Ba RPC !!! appel aux ingenieurs de la NASA ou presque [ par quentincabo ] Bonjour à tous les courageux,<b Update [ par VladDracula ] Voilà, j'ai fait un tit code qui marche pas mal mais je voudrais 'l'optimiser'.Cela consiste à regarder si on a la bonne version puis de télécharger l


Nos sponsors

Sondage...

CalendriCode

Juillet 2009
LMMJVSD
  12345
6789101112
13141516171819
20212223242526
2728293031  

Consulter la suite du CalendriCode

Téléchargements

Comparez les prix Nouvelle version

Photothèque Nouveau !



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
Temps d'éxécution de la page : 0,468 sec

Google Coop CodeS-SourceS Google Coop CodeS-SourceS


Certaines images présentes sur le site (notament certains avatars) sont issues des collections IconShock, donc si vous souhaitez utiliser ces icons vous devez les acheter, ne les copiez pas et ne utilisez pas dans vos sites et applications sans les avoir commandé.