jeudi 8 juin 2017

Using DataGridView, If and OR operator

I am exporting DataGridViews with ClipboardCopyMode in VB.NET. I have to do it for various DataGridViews. However, I have the following case:

ElseIf ComboBox.SelectedValue.ToString.Trim() = "N8" OrElse
                ComboBox.SelectedValue.ToString.Trim() = "N6" Then

            dgv.SelectAll()
            dgv.ClipboardCopyMode = DataGridViewClipboardCopyMode.EnableAlwaysIncludeHeaderText
            Clipboard.SetDataObject(dgv.GetClipboardContent())

Both of those conditions use the same DatagridView and both have data in it (they use the same. But one of them don't execute the block and go directly to my Else .

My condition is wrong? I have to use another operator?

I tried to put these conditions in separated ElseIf but I had the same results

Thanks in advance

Aucun commentaire:

Enregistrer un commentaire